C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » Windows »

datagridview in windows application


Posted Date: 21 Nov 2008      Posted By: Rajarajan      Member Level: Silver     Points: 1   Responses: 3



foreach (DataGridViewRow row in this.GrdBouquet.Rows)
{


if ((bool)row.Cells["checkbox1"].Value == true)//here i got this errror Object reference not set to an instance of an object.

{
//action;
}
}





Responses

Author: Deepika Haridas    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 1

Try these

Remove bool

or specifying column number like 0 or 1...

Regards,
Deepika



Thanks & Regards,
Deepika
Editor

If U want to shine like a SUN..First U have to burn like the SUN!!
Need a Guide? Join my mentor program..



Author: Anil Kumar Pandey    21 Nov 2008Member Level: DiamondRating: 2 out of 52 out of 5     Points: 4

hi,

u can use like this

if (dtgUsers.Rows[i].Cells[1].Value.ToString() == myItem.SubItems[1].Text.Trim())


foreach (DataGridViewRow row in this.GrdBouquet.Rows)
{


if (row.Cells["checkbox1"].Value == true)

{
//action;
}
}


Regards
Anil Pandey

Thanks & Regards
Anil Kumar Pandey



Author: Legend     21 Nov 2008Member Level: SilverRating: 2 out of 52 out of 5     Points: 3

hi,

u can use like this

if (dtgUsers.Rows[i].Cells[1].Value.ToString() == myItem.SubItems[1].Text.Trim())


foreach (DataGridViewRow row in this.GrdBouquet.Rows)
{


if (row.Cells["checkbox1"].Value == true)

{
//action;
}
}



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : how to read the binary data stored from sql db C#.NET windows application
Previous : Add Checkbox in DataGrid(Window application)
Return to Discussion Forum
Post New Message
Category: Windows

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use