datagrid checkbox

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

Hello,
I have a forms datagrid with booleanboxes in it. Works fine excepts for the
fact that I have to click twice to set/reset the checkmark.
First click the cell is selected and on the second click the checkmark is
(un)checked.
Is there a way to just click once to (un)check?
Thanks
Frank
 
This is my first post [which answer someone 's question, heeeheee] ** I will
check whether the user click the checkbox on the 3rd column or not .

Try the following code
Private Sub dgUser_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles dgUser.MouseUp
Dim hti As DataGrid.HitTestInfo = Me.dgUser.HitTest(e.X,
e.Y)
If hti.Type = DataGrid.HitTestType.Cell AndAlso (hti.Column
= 2) Then
Me.dgUserBranchForm(hti.Row, hti.Column) = Not
CBool(Me.dgUserBranchForm(hti.Row, hti.Column))
end if
end sub
 
Agnes

Welcome on the other side of the group, I did not read your answer by the
way before you expect that.

Cor
 
Agnes said:
This is my first post [which answer someone 's question, heeeheee] ** I will
check whether the user click the checkbox on the 3rd column or not .

Try the following code
Private Sub dgUser_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles dgUser.MouseUp
Dim hti As DataGrid.HitTestInfo = Me.dgUser.HitTest(e.X,
e.Y)
If hti.Type = DataGrid.HitTestType.Cell AndAlso (hti.Column
= 2) Then
Me.dgUserBranchForm(hti.Row, hti.Column) = Not
CBool(Me.dgUserBranchForm(hti.Row, hti.Column))
end if
end sub

Frank said:
Hello,
I have a forms datagrid with booleanboxes in it. Works fine excepts for the
fact that I have to click twice to set/reset the checkmark.
First click the cell is selected and on the second click the checkmark is
(un)checked.
Is there a way to just click once to (un)check?
Thanks
Frank

When I do this , if I click on a border between rows, start to get the error
"ListManager's position must be equal to rowNum" on clikcing the checkbox
column.
Does anyone else get this problem?
I have worked aroung this by adding the code
dgMyGrid.select(hti.row)
before toggling the value.

Jonathan Steinberg
BRCorp
(e-mail address removed) (Not NOT)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top