RT,如何判断呢?

解决方案 »

  1.   

       if (comboBox1.SelectedValue == null)
                { 
                
                }
      

  2.   

    if (comboBox1.SelectedItem==null)
                { 
                
                }
      

  3.   

     if (comboBox1.SelectedItem == null)
                {
                    MessageBox.Show("为空");
                }
      

  4.   

     private void btnSave_Click(object sender, EventArgs e)
            {
                if (cobType.SelectedValue == null)
                {
                    cobType.Focus();
                }
                else
                {
                    if (txtAddress.Text == string.Empty)
                    {
                        txtAddress.Focus();
                    }
                    else
                    {
                        if (txtArea.Text == string.Empty)
                        {
                            txtArea.Focus();
                        }
                     }
                }
            }
    为什么焦点总是第一个呢?
      

  5.   


    不好意思  第一个写错了 是comboBox1.SelectedItem==null