Click here to Skip to main content
15,666,844 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi, good morning to all
have datagridview in that i have datagridviewcombobox column on that i assigned two values but when load by default i am not able to show the first value as default value how i can do this?
and second i have checkbox column in that datagridview when i am retrieving value from database as 0 or 1. when there retrieved value is 1 then checkbox of that row is automatic checked and when retrieved value is 0 then checkbox ot that row is automatically unchecked how i can do this? please help me...

thanks and regards,
Updated 9-Apr-10 21:01pm

1 solution

Hi ,
For the first question u have to do this at the time of grid fill,
dgvAttendance.Rows[i].Cells[0].Value = "value";

for the second question u have to do this

foreach (DataGridViewRow dr in dgvSharesell.Rows)
if (dr.Cells[0].Value != null)
if (bool.Parse(dr.Cells[0].Value.ToString()) == true)
Share this answer

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