Click here to Skip to main content
15,885,365 members
Home / Discussions / C#
   

C#

 
QuestionRe: c# dot net Pin
Richard MacCutchan12-Dec-13 21:24
mveRichard MacCutchan12-Dec-13 21:24 
AnswerRe: c# dot net Pin
Janakiraman Subramanian13-Dec-13 21:42
professionalJanakiraman Subramanian13-Dec-13 21:42 
GeneralRe: c# dot net Pin
Richard MacCutchan13-Dec-13 22:28
mveRichard MacCutchan13-Dec-13 22:28 
QuestionHow Change Mouse Cursor for all windows c# Pin
delphix512-Dec-13 20:36
delphix512-Dec-13 20:36 
AnswerRe: How Change Mouse Cursor for all windows c# Pin
Marco Bertschi12-Dec-13 22:22
protectorMarco Bertschi12-Dec-13 22:22 
AnswerRe: How Change Mouse Cursor for all windows c# Pin
lijizhe12-Dec-13 23:06
lijizhe12-Dec-13 23:06 
AnswerRe: How Change Mouse Cursor for all windows c# Pin
Dave Kreskowiak13-Dec-13 4:02
mveDave Kreskowiak13-Dec-13 4:02 
QuestionAn unhandled exception of type 'System.NullReferenceException' occurred Pin
Member 1037988612-Dec-13 10:45
Member 1037988612-Dec-13 10:45 
Hi I am try to get rid of an error caused by a null when I run the app it stops at:

HERE---> if (mySettings.Contains("setUserName"))<---HERE

Error Message "An unhandled exception of type 'System.NullReferenceException' occurred in Password.dll"

it doesnt show any errors prior to the button click, app loads up fine.

code below

C#
using System.IO.IsolatedStorage;

namespace Password
{
    public partial class MainPage : PhoneApplicationPage
    {
         IsolatedStorageSettings mySettings;

public void Settings()
    {
InitializeComponent();
//Initialize the settings
mySettings = IsolatedStorageSettings.ApplicationSettings;
// Display settings stored in the local storage for setUserName
if (mySettings.Contains("setUserName"))
txtUserName.Text = mySettings["setUserName"].ToString();
// Display settings stored in the local storage for setPassword
if (mySettings.Contains("setPassword"))
txtPassword.Password = mySettings["setPassword"].ToString();
}
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
             if (txtUserName.Text != "" && txtPassword.Password != "")
{
if (txtPassword.Password == txtPasswordConfirm.Password)
{
//error here
if (mySettings.Contains("setUserName"))
//error here
{
mySettings["setUserName"] = txtUserName.Text;
}
else
mySettings.Add("setUserName", txtUserName.Text);
if (mySettings.Contains("setPassword"))
{
mySettings["setPassword"] = txtPassword.Password;
}
     else
mySettings.Add("setPassword", txtPassword.Password);
mySettings.Save();
MessageBox.Show("Settings Saved Successfully");
}
else
MessageBox.Show("Passwords are not matching");
        }
    }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.GoBack();
        }
}}

AnswerRe: An unhandled exception of type 'System.NullReferenceException' occurred Pin
Marco Bertschi12-Dec-13 10:51
protectorMarco Bertschi12-Dec-13 10:51 
AnswerRe: An unhandled exception of type 'System.NullReferenceException' occurred Pin
BillWoodruff12-Dec-13 19:35
professionalBillWoodruff12-Dec-13 19:35 
AnswerRe: An unhandled exception of type 'System.NullReferenceException' occurred Pin
WuRunZhe12-Dec-13 20:24
WuRunZhe12-Dec-13 20:24 
Questionbest way to license .net application Pin
Jassim Rahma12-Dec-13 5:26
Jassim Rahma12-Dec-13 5:26 
AnswerRe: best way to license .net application Pin
Marco Bertschi12-Dec-13 6:01
protectorMarco Bertschi12-Dec-13 6:01 
GeneralRe: best way to license .net application Pin
DaveAuld12-Dec-13 6:16
professionalDaveAuld12-Dec-13 6:16 
AnswerRe: best way to license .net application Pin
thatraja12-Dec-13 6:26
professionalthatraja12-Dec-13 6:26 
GeneralRe: best way to license .net application Pin
PIEBALDconsult12-Dec-13 17:36
mvePIEBALDconsult12-Dec-13 17:36 
AnswerRe: best way to license .net application Pin
jschell13-Dec-13 9:55
jschell13-Dec-13 9:55 
SuggestionHow to set transparent on listbox Pin
Member 1026763012-Dec-13 0:52
Member 1026763012-Dec-13 0:52 
GeneralRe: How to set transparent on listbox Pin
Simon_Whale12-Dec-13 1:03
Simon_Whale12-Dec-13 1:03 
GeneralRe: How to set transparent on listbox Pin
Marco Bertschi12-Dec-13 1:20
protectorMarco Bertschi12-Dec-13 1:20 
GeneralRe: How to set transparent on listbox Pin
Member 1026763012-Dec-13 1:44
Member 1026763012-Dec-13 1:44 
Questionserial port data read Pin
Member 1026351912-Dec-13 0:15
Member 1026351912-Dec-13 0:15 
AnswerRe: serial port data read Pin
Marco Bertschi12-Dec-13 1:22
protectorMarco Bertschi12-Dec-13 1:22 
QuestionHow to create an organizational chart in ASP with C# without api and HTML5 Pin
Member 1039478611-Dec-13 8:11
Member 1039478611-Dec-13 8:11 
AnswerRe: How to create an organizational chart in ASP with C# without api and HTML5 Pin
Dave Kreskowiak11-Dec-13 11:30
mveDave Kreskowiak11-Dec-13 11:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.