How to know DataGridViewCheckBoxCell is checked or unchecked C#
Datagridview дээр checkbox ашиглахаар түүний чагтлагдсан эсэхийг мэдэхийн тулд доорхи кодыг ашиглана.
 DataGridViewCheckBoxCell CbxCell = (DataGridViewCheckBoxCell)Datagridview1.Rows[rowIndex].Cells["Status"];
                if ((bool)CbxCell.Value == true)
                {
                    //Do stuff
                }
                else
                {
                    //Do Stuff
                }Мөн DBNULL байж болох учраас шалгахдаа дараах байдлаар бас шалгаж болно:
if (!DBNull.Value.Equals(CbxCell.Value) && (bool)CbxCell.Value == true)
{
    //Do stuff
}
else
{
    //Do Stuff
}
1:13 AM
 | 
Labels:
.NET C# programming
 | 
 
				 This entry was posted on 1:13 AM
	and is filed under          
.NET C# programming
						.
							
				You can follow any responses to this entry through 
				the RSS 2.0 feed. 
				
				
					You can leave a response,
		        
				or trackback from your own site.
			
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment