943,650 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 6084
  • VB.NET RSS
Dec 17th, 2008
0

Checkbox in Datagridview

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 2
Light Poster
manoj_582033 is offline Offline
39 posts
since Nov 2008
Dec 17th, 2008
0

Re: Checkbox in Datagridview

Are you adding checkboxes to datagrid at runtime?
VB.NET Syntax (Toggle Plain Text)
  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
VB.NET Syntax (Toggle Plain Text)
  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
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Teme64 is offline Offline
1,024 posts
since Aug 2008
Oct 19th, 2009
0
Re: Checkbox in Datagridview
How to select AllCheckBoxes in DataGridView1 in.Net 2005
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Esrinivas is offline Offline
1 posts
since Oct 2009
Oct 19th, 2009
0
Re: Checkbox in Datagridview
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
Reputation Points: 84
Solved Threads: 48
Posting Whiz
TomW is offline Offline
342 posts
since Sep 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: status strip
Next Thread in VB.NET Forum Timeline: Date/Time Stamped and Numbered filenames when saving to jpeg?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC