473,655 Members | 3,063 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 (programaticall y with
'DataGridBoolCo lumn'). 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 2035
Figured it out...with thanks to http://64.78.52.104/FAQ/WinForms/default.asp

Private Sub DataGrid1_Mouse Up(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles DataGrid1.Mouse Up
Dim intCheckBoxCol( ) As Integer = {4, 5, 6}
Dim hti As DataGrid.HitTes tInfo = Me.DataGrid1.Hi tTest(e.X, e.Y)
Try
For i As Integer = 0 To 2
If hti.Type = DataGrid.HitTes tType.Cell AndAlso hti.Column =
intCheckBoxCol( i) Then
Me.DataGrid1(ht i.Row, hti.Column) = Not
CBool(Me.DataGr id1(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_Mouse Up(ByVal sender As Object, ByVal e As
MouseEventArgs) Handles DataGrid1.Mouse Up
Dim intCheckBoxCol( ) As Integer = {4, 5, 6}
Dim hti As DataGrid.HitTes tInfo = Me.DataGrid1.Hi tTest(e.X, e.Y)
Try
For i As Integer = 0 To 2
If hti.Type = DataGrid.HitTes tType.Cell AndAlso hti.Column =
intCheckBoxCol( i) Then
Me.DataGrid1(ht i.Row, hti.Column) = Not
CBool(Me.DataGr id1(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
1359
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 to me... Yogi *** Sent via Devdex http://www.devdex.com ***
1
1884
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 an ArrayList. I came up against the issue of selecting a cell and getting the whole row to highlight, and the second issue of unhighlighting any previously selected row. To get around these two issues I have put in a two prong approach:
0
889
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 UnSelect on the row and setting the CurrentCell to another cell but that doesn't work. I've also tried doing... dataGrid1.EndEdit(null, myHitTest.Row, true); dataGrid1.BindingContext.DataGrid.DataMember].EndCurrentEdit(); but that didn't help...
2
1338
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 zero. i have looked into the other messages which guide to override the paint procedure of the datagrid, make a new class etc. i am not able to understand the exact way of doing the mentioned
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 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...
2
3672
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 columns for editing I know I can use readonly for the columnstyle but this will also disallow me to edit the cell when I add a new row. So I was thinking of using the overrides sub Edit in my class which inherits from DataGridTextBoxColumn and then...
0
903
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 System.EventArgs) Handles DG.CurrentCellChanged Dim tableStyle As DataGridTableStyle tableStyle = New DataGridTableStyle tableStyle.MappingName = "x"
2
2067
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 a row, I change the textbox (or other control), click Update, but it doesn't save my data. I then did this... In Page_Load, I added code to filter the DataGrid only when it was Not Page.IsPostBack. Then the editing/updating of the DataGrid data...
0
1107
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 where Select checkbox is checked in that row. Any ideas?
2
1034
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 be done?
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8497
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8598
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1598
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.