473,545 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagridview keypress event question

Bob
In that event, how can you find out if the keypress event was in a certain
column? Say you have datagridview1, columnname1, columnName2
You want to do something only with the keypress event of column2, do nothing
special with column1

Private Sub Datagrid1_KeyPr ess(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles Datagrid1.KeyPr ess

If Me.datagrid1... ...... Then - how do you specify its for column2,
can't find the way via intellisense properties

End If

End Sub

Thanks for any help

Bob


Jan 11 '06 #1
2 7989
Bob
Found it!
Its
If Me.DataGRidview 1.CurrentCell.O wningColumn.Dat aPropertyName =
"MyDataProperty Name" Then

Talk about going around incircles to get something done !
hehehe

Bob
"Bob" <bd*****@sgiims .com> wrote in message
news:%2******** *******@TK2MSFT NGP11.phx.gbl.. .
In that event, how can you find out if the keypress event was in a certain
column? Say you have datagridview1, columnname1, columnName2
You want to do something only with the keypress event of column2, do
nothing special with column1

Private Sub Datagrid1_KeyPr ess(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyPressE ventArgs) Handles Datagrid1.KeyPr ess

If Me.datagrid1... ...... Then - how do you specify its for column2,
can't find the way via intellisense properties

End If

End Sub

Thanks for any help

Bob


Jan 11 '06 #2
valiant
1 New Member
Hello Bob,
This was what I was looking for..BUT they datagridview keypress handler won't respond if you edit a cell in that particular colum. I only can make it work when editing in the first column. Any ideas?

thanks
Sean

Private Sub DataGridView1_K eyPress(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles DataGridView1.K eyPress

With DataGridView1
If .CurrentCell.Ow ningColumn.Data PropertyName = "Name" Then
If e.KeyChar = "1" Then
'do something
End If
End If
End With

End Sub

Found it!
Its
If Me.DataGRidview 1.CurrentCell.O wningColumn.Dat aPropertyName =
"MyDataProperty Name" Then

Talk about going around incircles to get something done !
hehehe

Bob


"Bob" <bdufour@sgiims .com> wrote in message
news:%23QUJaPvF GHA.344@TK2MSFT NGP11.phx.gbl.. .[color=blue]
> In that event, how can you find out if the keypress event was in a certain
> column? Say you have datagridview1, columnname1, columnName2
> You want to do something only with the keypress event of column2, do
> nothing special with column1
>
> Private Sub Datagrid1_KeyPr ess(ByVal sender As Object, ByVal e As
> System.Windows. Forms.KeyPressE ventArgs) Handles Datagrid1.KeyPr ess
>
> If Me.datagrid1... ...... Then - how do you specify its for column2,
> can't find the way via intellisense properties
>
>
>
> End If
>
> End Sub
>
> Thanks for any help
>
> Bob
>
>
>
>
>
>[/color]
Mar 22 '06 #3

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

Similar topics

2
16092
by: Stephen Saunders | last post by:
I have a text box for entering in a search string on my form. I coded the following KeyPress event handler: Private Sub txtFindCall_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdFind_Click Exit Sub End If
4
8971
by: phil_gg04 | last post by:
Dear Javascript Experts, I'm currently implementing Anyterm, a terminal emulator on a web page. It consists of an Apache module, some XmlHTTP and a bit of Javascript. The idea is to give you shell access to your server from (almost) anywhere; other solutions to the problem tend to require access to ports other than 80 and Java. The very...
0
3356
by: LordHog | last post by:
Hello all, I am trying to implement an event handler for the KeyPress event for a cell within a DataGridView control. The obvous starting point from the DataGridView keypress event, but this doesn't work for the cell. I found this posting while searching, but this doesn't work with the .NET 2.0 beta framework. ...
4
4520
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters anything into the textbox (for instance) I trap the keypress event to handle some stuff (i.e. if it is an enter key, etc). Now, once I am done with...
3
3064
by: Terry Olsen | last post by:
Is there anyway to cause a KeyPress event in a datagrid cell? The only way I get a keypress event is if none of the cells are selected. I was hoping to have the program respond to a certain keypress while in a cell of a datagrid but it doesn't fire the keypress event.
3
1866
by: Just Me | last post by:
I noticed that I don't get KeyDown nor KetPress events if NumLock is not on. I can probably find a workaround but it would be nice to know what the rules are. Can anyone tell me when KeyPress event is raised and when it isn't. Thanks
3
7266
by: Nikolay Evseev | last post by:
Hi, I am trying to trace down the Enter key in my Form.KeyPress event handler. The KeyPreview property is set to false, so I'd assume that all key presses should go through my form's KeyPress event handler, right? Ok. If the focus is set to any other control than a button, then the above event handler fires, but if the focus is on a button,...
0
1656
by: Rich | last post by:
Hello, I have been using "Concole.WriteLine("Event Name") for almost every event in the datagridview control, but I can't get the KeyPress event to file. My goal is to force uppercase on the KeyPress event of the datagridView. But that event does not seem to file. Is there a cell formatting property or some CharacterCasting property...
3
2104
by: windy | last post by:
I got a question about keypress event on textbox: I found that the keypress event doesn't invoked when i press the "." button on alphabetic keyboard, however if i use numberpad's "." button keypress event is invoked. Any idea and solutions? Thanks.
0
7676
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. ...
0
7932
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7442
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...
0
7776
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...
1
5347
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...
0
4965
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3456
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1905
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

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.