Checkbox in Datagridview

Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2008
Posts: 34
Reputation: manoj_582033 is an unknown quantity at this point 
Solved Threads: 0
manoj_582033 manoj_582033 is offline Offline
Light Poster

Checkbox in Datagridview

 
0
  #1
Dec 17th, 2008
Hi friends

I am working in vb.net ,there is i have a form in which i have a datagridview,& a column of checkbox in tat datagridview,when this datagridview becomes load, that checkes theb employee is present or absent if present so the check box of that perticular row must be checked true else checked false,for this i did

dim chk as checkbox

if condition that
chk.checked=true
else
chk.checked=false
end if
but it giving me a error message "object refrence not set"

please help me to solve this problem
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: Checkbox in Datagridview

 
0
  #2
Dec 17th, 2008
Are you adding checkboxes to datagrid at runtime?
  1. Dim chk As New DataGridViewCheckBoxCell
  2.  
  3. If condition Then
  4. chk.Value = True
  5. Else
  6. chk.Value = False
  7. End If
  8. ' Add checkbox control to datagrid
  9. DataGridView1.Item(0, 0) = chk
If not, then
  1. If condition Then
  2. DataGridView1.Item(0, 0).Value = True
  3. Else
  4. DataGridView1.Item(0, 0).Value = False
  5. End If
"object reference not set"-error comes from declaring an object dim chk as checkbox but not creating the instance, like dim chk as New checkbox
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 1
Reputation: Esrinivas is an unknown quantity at this point 
Solved Threads: 0
Esrinivas Esrinivas is offline Offline
Newbie Poster
 
0
  #3
Oct 19th, 2009
How to select AllCheckBoxes in DataGridView1 in.Net 2005
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 289
Reputation: TomW is on a distinguished road 
Solved Threads: 38
TomW TomW is offline Offline
Posting Whiz in Training
 
0
  #4
Oct 19th, 2009
You should start your own thread for new questions. But to quickly answer your question, you want to work with the underlying datasource that is connected to the datagridview. For instance if it is a datatable that is connected, you want to set the table with the boolean column to true
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC