473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles Datagrid1.KeyPress

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 7977
Bob
Found it!
Its
If Me.DataGRidview1.CurrentCell.OwningColumn.DataProp ertyName =
"MyDataPropertyName" Then

Talk about going around incircles to get something done !
hehehe

Bob
"Bob" <bd*****@sgiims.com> wrote in message
news:%2***************@TK2MSFTNGP11.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_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles Datagrid1.KeyPress

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
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_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles DataGridView1.KeyPress

With DataGridView1
If .CurrentCell.OwningColumn.DataPropertyName = "Name" Then
If e.KeyChar = "1" Then
'do something
End If
End If
End With

End Sub

Found it!
Its
If Me.DataGRidview1.CurrentCell.OwningColumn.DataProp ertyName =
"MyDataPropertyName" Then

Talk about going around incircles to get something done !
hehehe

Bob


"Bob" <bdufour@sgiims.com> wrote in message
news:%23QUJaPvFGHA.344@TK2MSFTNGP11.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_KeyPress(ByVal sender As Object, ByVal e As
> System.Windows.Forms.KeyPressEventArgs) Handles Datagrid1.KeyPress
>
> 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
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...
4
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...
0
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...
4
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...
3
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...
3
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...
3
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...
0
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...
0
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...

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.