Skin designed by Auron89.Find more great skins at Silent Designs!
Image hosted by Photobucket.com


 

 keypress-event at vb6, how does it work
The Pentium Guy
Posted: Oct 6 2004, 12:47 AM


The Boss.


Group: Admin
Posts: 743
Member No.: 1
Joined: 4-July 03



Hmm I'm not too sure either - PerformClick would basically call the click event
so this is what you should do..

just call Button1_Click() smile.gif

In .NET it might make the button "Animate" as if it was clicking (i'm not too sure about that) but in either case, it would call the click event

-The Pentium Guy
Top
fadixp
Posted: Nov 14 2004, 08:16 AM


Programmer


Group: Members
Posts: 76
Member No.: 70
Joined: 11-November 04



well
you can use keyascii like :

if keyascii = 13 then
msgbox ("Enter")
end if

to find out the value of each button you are pressing in keydown event type :
msgbox keyascii


if it didntt work let me know so i install vb6 and double check for you
Top
DaRock
Posted: Dec 15 2004, 05:07 AM


Senior Developer / Software Engineer


Group: Members
Posts: 82
Member No.: 75
Joined: 4-December 04



Just a technique critique <- I'm a poet!.

If you ever really need to call the event, then it might be best to place the code in a Sub or Function that the event calls; that way if you need to reuse the function or sub some where else it is available.

EXAMPLE:

CODE
Public Class BLAH

Public Sub Dosomething(Sender as object, e as System.EventArgs)
.
.
.
End Sub

Public sub Object_Click(Sender as Object, e as System.EventArgs) Handles Object.Click

Call Dosomething(Sender,e)
End Sub

Public Sub Object2_Click(Sender as Object, e as System.EventArgs) Handles Object2.Click
Call Dosomething(Sender,e)
'----- Do Something else ------
End Sub


End Class



Now some cases you want the event "Tied" or to cascade to other users across a platform (Usually Client/Server development) at this point you probably want to not use the event and do an AddHandler routine to tie the event to a Sub or Function; so that it can cascade the information..

Just an FYI; throwing a wrench in the conversation..

-DaRock
Top
DaRock
Posted: Dec 15 2004, 05:11 AM


Senior Developer / Software Engineer


Group: Members
Posts: 82
Member No.: 75
Joined: 4-December 04



In VB6 all objects are COM based, err most objects are COM based so, they generate the event signature

generally in a form of <object>_Keydown

to invoke the event is the same as invoking a sub routine call just simply place a call statement before the event (or leave blank isn't required, I do it to code for good form)

Call <object>_Keydown(args)

In VB.NET the contrast is that the events are object based; and that really is a debate in terminolgy. To invoke it you call the signature call using the "." seperator; which then looks as a property / method list

Object.Keydown

or what have you.

Hope that help clarifies.

-DaRock
Top
fadixp
Posted: Dec 16 2004, 04:15 AM


Programmer


Group: Members
Posts: 76
Member No.: 70
Joined: 11-November 04



DaRock explination is extremly nice ...
i like this smile.gif
way to go DaRock
Top


Topic Options Quick Reply




Hosted for free by InvisionFree (Terms of Use: Updated 7/7/05) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.4030 seconds | Archive

Check out the Shoutbox! Type in your name and the message to shout ;).