Event Handling & f1 Key

  • Thread starter Thread starter Martin Hills
  • Start date Start date
M

Martin Hills

Hi

Wondered if anyone can help with a couple of small
problems we are having.

Firstly, how do we check if someone has hit the F1 within
a TextBox field?

Secondly, we are having problem with handling events. We
have used the follwing code to track that a called screen
has been closed. What we also want is when a push button
is pressed to close the other form to perform the same
sub. We have tried using cat_lu.closed or or the push
button click-event but to no avail!

Dim Cat_Lu As New frmCat_Lu
AddHandler Cat_Lu.Closing, AddressOf Refresh_Cat
Cat_Lu.Show()

Any help would be gratefully received!

Regards

Martin
 
Hi Martin,

Private Sub textbox1_KeyUp(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles textbox1.KeyUp
If e.KeyCode = Keys.F1 Then


For the second problem you can look what a class with shared functions/subs
can do for you. You have than a lot of scennario's, keep track in that what
is the current form and also you can put that code from that sub in it
Secondly, we are having problem with handling events. We
have used the follwing code to track that a called screen
has been closed. What we also want is when a push button
is pressed to close the other form to perform the same
sub. We have tried using cat_lu.closed or or the push
button click-event but to no avail!

I hope this helps a little bit.

Cor
 
Hi Cor

Many thanks for the reply, your first answer works a
treat. Sorry but I didn't understand the second answer
probably because I am so new to vb.net. If you could
clarify it would be most appreciated.

Cheers

Martin
 
Hi Martin,

Trying to track an event of an closing form is theoposite way in my eyes.

You know what you are doing, so when you open a form tell what form it is
somewhere. You can by instance make a class for this
\\\
Public class mySpecial
Private shared mlast as string
Public shared property MylastProgram
Get
Return pFormWidth
End get
Set (byval value as string)
mlast = value
end set
end property
Public Shared sub MartinSpecial ()
here I can do everything i want in all my programs
end sub
end class
///

In all the forms (classes) you can say
\\\
mySpecial.MylastProgram = X
or if mySpecial.mylastprogram = X etc
///
And you can do
\\\
mySpecial.MartinSpecial()
///

I hope this helps a little bit to bring you on that route?

Cor
 
Hi Martin,

This is an error, typed it to much again whil I first was making two classes
with different names. Maybe there are more typo's but it is of course of the
idea how to do it.
Return mlast

Sorry

Cor
 
Back
Top