469,587 Members | 2,178 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,587 developers. It's quick & easy.

activate a click onto a picture button

Dear All,

I am new to vb , please help.

I have a picture , and a picture_click( ) function. What I want to do is to
have a simulate a click event onto the picture in a loop. However, when I
write:
for i = 1 to 10
picture_click()
....
it gives me an error messge, said that I missed some parameter in the click
function call.
I searched through google, and found some people suggest to put "sender" and
"e" in the () as parameter.

but then another error message generated, sender and e is not definted.

Can you help? thanks.
Jul 5 '06 #1
4 1718
Elton,

You are not the first who asked this, but why not call just the event that
you want to do with the click than to perform the click.

MyEvent(nothing,nothing) is mostly the most easiest, you can for the rest
make it as nice as you want.

(For this we get a reply from Herfried as usual).

Cor

"Elton" <he********@yahoo.comschreef in bericht
news:el**************@TK2MSFTNGP03.phx.gbl...
Dear All,

I am new to vb , please help.

I have a picture , and a picture_click( ) function. What I want to do is
to have a simulate a click event onto the picture in a loop. However, when
I write:
for i = 1 to 10
picture_click()
....
it gives me an error messge, said that I missed some parameter in the
click function call.
I searched through google, and found some people suggest to put "sender"
and "e" in the () as parameter.

but then another error message generated, sender and e is not definted.

Can you help? thanks.

Jul 5 '06 #2
thanks.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uW**************@TK2MSFTNGP03.phx.gbl...
Elton,

You are not the first who asked this, but why not call just the event that
you want to do with the click than to perform the click.

MyEvent(nothing,nothing) is mostly the most easiest, you can for the rest
make it as nice as you want.

(For this we get a reply from Herfried as usual).

Cor

"Elton" <he********@yahoo.comschreef in bericht
news:el**************@TK2MSFTNGP03.phx.gbl...
>Dear All,

I am new to vb , please help.

I have a picture , and a picture_click( ) function. What I want to do is
to have a simulate a click event onto the picture in a loop. However,
when I write:
for i = 1 to 10
picture_click()
....
it gives me an error messge, said that I missed some parameter in the
click function call.
I searched through google, and found some people suggest to put "sender"
and "e" in the () as parameter.

but then another error message generated, sender and e is not definted.

Can you help? thanks.


Jul 5 '06 #3

i do something else
in all the projects i write i only use the events as callers to my methods
this makes life a lot easier :-)

example ?
so instead of this

Private Sub btnSavePicture_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnSavePicture.Click
' Compose the picture's base file name.
Dim file_name As String = Application.ExecutablePath
file_name = file_name.Substring(0, _
file_name.LastIndexOf("\bin")) & _
"\test."

' Get a Bitmap.
Dim bm As Bitmap = picImage.Image

' Save the picture as a bitmap, JPEG, and GIF.
bm.Save(file_name & "bmp", _
System.Drawing.Imaging.ImageFormat.Bmp)
bm.Save(file_name & "jpg", _
System.Drawing.Imaging.ImageFormat.Jpeg)
bm.Save(file_name & "gif", _
System.Drawing.Imaging.ImageFormat.Gif)

End Sub


i do this
Private Sub btnSavePicture_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnSavePicture.Click

SavePicture()
End Sub

private sub SavePicture ()
' Compose the picture's base file name.
Dim file_name As String = Application.ExecutablePath
file_name = file_name.Substring(0, _
file_name.LastIndexOf("\bin")) & _
"\test."

' Get a Bitmap.
Dim bm As Bitmap = picImage.Image

' Save the picture as a bitmap, JPEG, and GIF.
bm.Save(file_name & "bmp", _
System.Drawing.Imaging.ImageFormat.Bmp)
bm.Save(file_name & "jpg", _
System.Drawing.Imaging.ImageFormat.Jpeg)
bm.Save(file_name & "gif", _
System.Drawing.Imaging.ImageFormat.Gif)
end sub

"Elton" <he********@yahoo.comschreef in bericht
news:uT**************@TK2MSFTNGP05.phx.gbl...
thanks.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uW**************@TK2MSFTNGP03.phx.gbl...
>Elton,

You are not the first who asked this, but why not call just the event
that you want to do with the click than to perform the click.

MyEvent(nothing,nothing) is mostly the most easiest, you can for the rest
make it as nice as you want.

(For this we get a reply from Herfried as usual).

Cor

"Elton" <he********@yahoo.comschreef in bericht
news:el**************@TK2MSFTNGP03.phx.gbl...
>>Dear All,

I am new to vb , please help.

I have a picture , and a picture_click( ) function. What I want to do is
to have a simulate a click event onto the picture in a loop. However,
when I write:
for i = 1 to 10
picture_click()
....
it gives me an error messge, said that I missed some parameter in the
click function call.
I searched through google, and found some people suggest to put "sender"
and "e" in the () as parameter.

but then another error message generated, sender and e is not definted.

Can you help? thanks.



Jul 5 '06 #4
good idea.

Elton

"Michel Posseth [MCP]" <MS**@posseth.comwrote in message
news:Ol**************@TK2MSFTNGP03.phx.gbl...
>
i do something else
in all the projects i write i only use the events as callers to my methods
this makes life a lot easier :-)

example ?
so instead of this

Private Sub btnSavePicture_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnSavePicture.Click
' Compose the picture's base file name.
Dim file_name As String = Application.ExecutablePath
file_name = file_name.Substring(0, _
file_name.LastIndexOf("\bin")) & _
"\test."

' Get a Bitmap.
Dim bm As Bitmap = picImage.Image

' Save the picture as a bitmap, JPEG, and GIF.
bm.Save(file_name & "bmp", _
System.Drawing.Imaging.ImageFormat.Bmp)
bm.Save(file_name & "jpg", _
System.Drawing.Imaging.ImageFormat.Jpeg)
bm.Save(file_name & "gif", _
System.Drawing.Imaging.ImageFormat.Gif)

End Sub


i do this
Private Sub btnSavePicture_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnSavePicture.Click

SavePicture()
End Sub

private sub SavePicture ()
' Compose the picture's base file name.
Dim file_name As String = Application.ExecutablePath
file_name = file_name.Substring(0, _
file_name.LastIndexOf("\bin")) & _
"\test."

' Get a Bitmap.
Dim bm As Bitmap = picImage.Image

' Save the picture as a bitmap, JPEG, and GIF.
bm.Save(file_name & "bmp", _
System.Drawing.Imaging.ImageFormat.Bmp)
bm.Save(file_name & "jpg", _
System.Drawing.Imaging.ImageFormat.Jpeg)
bm.Save(file_name & "gif", _
System.Drawing.Imaging.ImageFormat.Gif)
end sub

"Elton" <he********@yahoo.comschreef in bericht
news:uT**************@TK2MSFTNGP05.phx.gbl...
>thanks.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uW**************@TK2MSFTNGP03.phx.gbl...
>>Elton,

You are not the first who asked this, but why not call just the event
that you want to do with the click than to perform the click.

MyEvent(nothing,nothing) is mostly the most easiest, you can for the
rest make it as nice as you want.

(For this we get a reply from Herfried as usual).

Cor

"Elton" <he********@yahoo.comschreef in bericht
news:el**************@TK2MSFTNGP03.phx.gbl...
Dear All,

I am new to vb , please help.

I have a picture , and a picture_click( ) function. What I want to do
is to have a simulate a click event onto the picture in a loop.
However, when I write:
for i = 1 to 10
picture_click()
....
it gives me an error messge, said that I missed some parameter in the
click function call.
I searched through google, and found some people suggest to put
"sender" and "e" in the () as parameter.

but then another error message generated, sender and e is not definted.

Can you help? thanks.



Jul 6 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Imran Aziz | last post: by
1 post views Thread by kimmie | last post: by
2 posts views Thread by Kishan Hathiwala | last post: by
reply views Thread by Jim in Arizona | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.