Click here to Skip to main content
15,889,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to retrive a value from a gridview cell click and fill that value in checklistbox so how can i fill that data in cheklistbox.. ?
Posted

1 solution

You can proceed as follows :
C#
//on click event of datagrid
private void datagrid_CellClick(System.Object sender, System.Windows.Forms.DataGridViewCellEventArgs e)
{
	string val = null;
	//if cell of data grid row is clicked then
	if (e.RowIndex > -1 & e.ColumnIndex > -1) {
		val = this.datagrid.Rows(e.RowIndex).Cells(2).Value;
		//2 is your column index of data grid
		// Check As of your logic
		if (val == "ram") {
			this.checkList.Items(1).@checked = true;
		}

	}
}


comment for any further queries.
 
Share this answer
 
v3
Comments
kansara darshit 13-Jun-13 8:45am    
My project is in C# and i want to retrive value from gridview to checklistbox
so how can i do that?
Surendra Adhikari SA 13-Jun-13 21:18pm    
ok i have updated above example in c# , you can modify this as of your logic
Surendra Adhikari SA 14-Jun-13 7:30am    
have you solved it? any error from above code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900