Click here to Skip to main content
16,006,006 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: ListBox Question Pin
Anonymous14-Jul-05 9:41
Anonymous14-Jul-05 9:41 
GeneralI could not load the data in CrystalReport Pin
Jeeva Jose14-Jul-05 5:40
Jeeva Jose14-Jul-05 5:40 
GeneralVB.NET Global Event Pin
Purple Monk14-Jul-05 5:12
Purple Monk14-Jul-05 5:12 
GeneralRe: VB.NET Global Event Pin
Anonymous14-Jul-05 5:56
Anonymous14-Jul-05 5:56 
GeneralRe: VB.NET Global Event Pin
Anonymous14-Jul-05 6:00
Anonymous14-Jul-05 6:00 
GeneralRe: VB.NET Global Event Pin
Dave Kreskowiak14-Jul-05 6:04
mveDave Kreskowiak14-Jul-05 6:04 
GeneralRe: VB.NET Global Event Pin
Dave Kreskowiak14-Jul-05 6:02
mveDave Kreskowiak14-Jul-05 6:02 
GeneralRe: VB.NET Global Event Pin
Purple Monk14-Jul-05 23:45
Purple Monk14-Jul-05 23:45 
Thanks everybody for the replies.

Thought I'd let you know what i found out, although KeyPreview looked good i had just found what i wanted, this doesn't mean i not grateful for the reply as i am and i almost used it anyway as it looked good and i think i might still.

However i found two ways of doing something similar to what i wanted.

They are....

method 1, rather than have several key press events you can have one sub that handles them all if you add the keypress for each on the end of the event handles bit, although this does mean adding all 75 controls on the end like so....

Private Sub Button1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Button1.KeyPress, ListBox1.KeyPress, Label1.KeyPress, PictureBox1.KeyPress, etc.KeyPress
End Sub

method 2, found a piece of code to add the keypress handler for a control to another sub

Public Sub AddKeyPressEvent(ByVal ControlName As Control)
AddHandler ControlName.KeyPress, AddressOf GenericKeyPressEvent
End Sub

Public Sub GenericKeyPressEvent(ByVal sender As Object, ByVal e As KeyPressEventArgs)
MsgBox(e.KeyChar)
End Sub

You just call AddKeyPressEvent(Listbox1) and then it's keypress event will be GenericKeyPressEvent,
Using this i could loop through the controls on the form and add them all at startup, clunky but effective, however keypreveiw looks good.

Thanks again

Hope this helps someone else with this problem.;P

"If i was king cigarettes would be free."


GeneralRe: VB.NET Global Event Pin
Dave Kreskowiak15-Jul-05 1:37
mveDave Kreskowiak15-Jul-05 1:37 
GeneralVB6 to VB.NET Marshal Structure Pin
meyerengineering14-Jul-05 4:53
meyerengineering14-Jul-05 4:53 
GeneralRe: VB6 to VB.NET Marshal Structure Pin
Dave Kreskowiak14-Jul-05 5:51
mveDave Kreskowiak14-Jul-05 5:51 
GeneralRe: VB6 to VB.NET Marshal Structure Pin
meyerengineering14-Jul-05 6:31
meyerengineering14-Jul-05 6:31 
GeneralRe: VB6 to VB.NET Marshal Structure Pin
Dave Kreskowiak14-Jul-05 6:44
mveDave Kreskowiak14-Jul-05 6:44 
GeneralRe: VB6 to VB.NET Marshal Structure Pin
meyerengineering14-Jul-05 8:06
meyerengineering14-Jul-05 8:06 
GeneralRe: VB6 to VB.NET Marshal Structure Pin
meyerengineering15-Jul-05 4:16
meyerengineering15-Jul-05 4:16 
GeneralRe: VB6 to VB.NET Marshal Structure Pin
progload15-Jul-05 5:25
progload15-Jul-05 5:25 
Generalopen email Pin
Ali el14-Jul-05 4:52
Ali el14-Jul-05 4:52 
GeneralRe: open email Pin
Dave Kreskowiak14-Jul-05 5:48
mveDave Kreskowiak14-Jul-05 5:48 
GeneralRe: open email Pin
Ali el15-Jul-05 6:22
Ali el15-Jul-05 6:22 
GeneralRe: open email Pin
Dave Kreskowiak15-Jul-05 11:45
mveDave Kreskowiak15-Jul-05 11:45 
GeneralRe: open email Pin
Ali el17-Jul-05 5:03
Ali el17-Jul-05 5:03 
GeneralProblem in Data Reports in VB 6.0 Pin
Birdy14-Jul-05 3:48
Birdy14-Jul-05 3:48 
GeneralRe: Problem in Data Reports in VB 6.0 Pin
rwestgraham14-Jul-05 11:23
rwestgraham14-Jul-05 11:23 
GeneralRe: Problem in Data Reports in VB 6.0 Pin
Birdy15-Jul-05 2:08
Birdy15-Jul-05 2:08 
Generalnahelp me in this printing problem-- nidhi s Pin
pnavkumar@yahoo.co.in14-Jul-05 1:16
susspnavkumar@yahoo.co.in14-Jul-05 1:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.