473,503 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit Checkbox (in DataGrid) when enter cell?

I have added a checkbox to my datagrid (programatically with
'DataGridBoolColumn'). It works great...except one thing...when I first
click on the checkbox in my grid it doesn't do anything...it's like its only
getting focus (it's not grey). After the initial click, I can toggle the
checkmark. The one thing I notice is the record pointer in the datagrid.
On the first click (into the cell), it's still an arrow. But when I start
to toggle the checkmark, I noticed it's a pencil.

Any advice?

Sorry, I'm a bit new to VB.NET.

-bruce duncan
Nov 21 '05 #1
2 2021
Figured it out...with thanks to http://64.78.52.104/FAQ/WinForms/default.asp

Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles DataGrid1.MouseUp
Dim intCheckBoxCol() As Integer = {4, 5, 6}
Dim hti As DataGrid.HitTestInfo = Me.DataGrid1.HitTest(e.X, e.Y)
Try
For i As Integer = 0 To 2
If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column =
intCheckBoxCol(i) Then
Me.DataGrid1(hti.Row, hti.Column) = Not
CBool(Me.DataGrid1(hti.Row, hti.Column))
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
-bruce
Nov 21 '05 #2
Figured it out...with thanks to http://64.78.52.104/FAQ/WinForms/default.asp

Private Sub DataGrid1_MouseUp(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles DataGrid1.MouseUp
Dim intCheckBoxCol() As Integer = {4, 5, 6}
Dim hti As DataGrid.HitTestInfo = Me.DataGrid1.HitTest(e.X, e.Y)
Try
For i As Integer = 0 To 2
If hti.Type = DataGrid.HitTestType.Cell AndAlso hti.Column =
intCheckBoxCol(i) Then
Me.DataGrid1(hti.Row, hti.Column) = Not
CBool(Me.DataGrid1(hti.Row, hti.Column))
End If
Next
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
End Sub
-bruce
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1352
by: yoganand reddy | last post by:
Hello, we are developing component in c# like a datagrid , if u are selecting any cell in grid it selects the total row and display record there itself , if any body have this idea please share...
1
1875
by: orekinbck | last post by:
Hi There I have a datagrid whose main purpose in life is to provide a nice way for users to make a single choice from a list. The grid is read only, single row select and has its data source as...
0
881
by: Randy | last post by:
Hello, Does anyone know if there's a way to unselect a cell. I've got a dialog which opens when a cell is clicked. When the dialog closes I want to leave that cell. I've tried things like doing an...
2
1331
by: hemant | last post by:
hello everybody, I am having a datagrid which has data regarding customers. it has a penalty column, and i want to show the entire record of the customer in red whose penalty is greater than...
0
312
by: Bruce D | last post by:
I have added a checkbox to my datagrid (programatically with 'DataGridBoolColumn'). It works great...except one thing...when I first click on the checkbox in my grid it doesn't do anything...it's...
2
3649
by: Peter Proost | last post by:
Hi group I'm making my own datagrid control, so for I've got a lot of things working, combobox columns, checkbox columns, blobfield columns. But now I would like to be able the disable certain...
0
891
by: Thanks | last post by:
Can I do that? I want to color the cell after updating by users! I was writing some code but did not work ... Private Sub DG_CurrentCellChanged(ByVal sender As Object, ByVal e As...
2
2060
by: Gummy | last post by:
Hello All, I have a webpage that has two dropdown listboxes. Based on what is selected in these dropdown listboxes, it filters a DataGrid . That works fine. In the DataGrid , when I go to edit...
0
1101
by: sevenjerry | last post by:
I am having a problem retrieving the productID(column) in datagrid when check box in template column is checked. I need to loop through all rows in the datagrid and save the productID for rows...
2
1022
by: KA NMC | last post by:
How do you raise an event when a cell in a row changes? I'm using a Datagrid not a Datagrid view. What I want to do is - call my update param when the user changes a value in a cell. How can this...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.