Null reference combobox.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wivked
    New Member
    • Jun 2010
    • 3

    Null reference combobox.

    Hi,

    I've got a problem with my program.

    Code:
    string locatielist = cbLocaties.SelectedItem.ToString();  
               
    
                 if (locatielist == null && tbXcor.Text == string.Empty && tbYcor.Text == string.Empty)
                 {
                     Simtimer.Stop();
                     MessageBox.Show("ERROR");
                 }
    btw
    Code:
    cbLocaties
    is a combobox.
  • wivked
    New Member
    • Jun 2010
    • 3

    #2
    Nevermind,, i got it :) sorry for the spam

    Code:
    object item = cbLocaties.SelectedItem;
    
    
                if (item != null || tbXcor.Text != string.Empty && tbYcor.Text != string.Empty)
                {
                    item.ToString();
    
                }
                else
                {
                    Simtimer.Stop();
                    MessageBox.Show("ERRROR");
                }
    
                Simtimer1.Stop();

    Comment

    Working...