Windows Develop Bookmark and Share   
 index > Windows Forms General > Datagrid-Checkbox-Check for empty or unselected - WinForms
 

Datagrid-Checkbox-Check for empty or unselected - WinForms

I am using WinForms- I amusing the IsNullOrEmpty method and it says it can not convert from Object to string. I want to test for a null/empty checkbox. What's the best way or how?

if (string.IsNullOrEmpty(dataGrid.Rows[0].Cells[0].Value))

{

MessageBox.Show("The value equals Null.", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

}

DalenFlorida  Wednesday, June 25, 2008 6:50 PM

I found it. This is what I was looking for to test for a non checked checkbox.

if (Convert.IsDBNull(dataGrid.Rows[0].Cells[0].Value)) //CheckState.Checked

{

MessageBox.Show("The value equals Null.", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

}

DalenFlorida  Wednesday, June 25, 2008 8:42 PM

I found it. This is what I was looking for to test for a non checked checkbox.

if (Convert.IsDBNull(dataGrid.Rows[0].Cells[0].Value)) //CheckState.Checked

{

MessageBox.Show("The value equals Null.", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);

}

DalenFlorida  Wednesday, June 25, 2008 8:42 PM

You can use google to search for other answers

Custom Search

More Threads

• C# timer Help
• Porting global.asax to WinApp
• DataGridView Remove VS Visible = False
• image.fromfile() method.
• Runtime Performance
• control.getnextcontrol not give me reference to a control from a control in a usercontrol
• How can i make errorProvider show me the error message without the icon and in a label, And not in a tooltip?
• Esc and Enter Key not working on the form
• C# - How to customize grid color at specific header cell, column, row or cell of dataGridView?
• Code generation for property 'Collection' failed.