Home All Groups Group Topic Archive Search About

activate a click onto a picture button

Author
5 Jul 2006 1:55 PM
Elton
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.

Author
5 Jul 2006 3:41 PM
Cor Ligthert [MVP]
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

Show quoteHide quote
"Elton" <helpme_***@yahoo.com> schreef in bericht
news:el2T4qDoGHA.4772@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.
>
Author
5 Jul 2006 3:58 PM
Elton
thanks.


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uWOlRlEoGHA.1236@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" <helpme_***@yahoo.com> schreef in bericht
> news:el2T4qDoGHA.4772@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.
>>
>
>
Author
5 Jul 2006 8:48 PM
Michel Posseth [MCP]
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





Show quoteHide quote
"Elton" <helpme_***@yahoo.com> schreef in bericht
news:uTDvPvEoGHA.4248@TK2MSFTNGP05.phx.gbl...
> thanks.
>
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:uWOlRlEoGHA.1236@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" <helpme_***@yahoo.com> schreef in bericht
>> news:el2T4qDoGHA.4772@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.
>>>
>>
>>
>
>
Author
6 Jul 2006 3:38 AM
Elton
good idea.

Elton

Show quoteHide quote
"Michel Posseth [MCP]" <M***@posseth.com> wrote in message
news:OlctiQHoGHA.4124@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" <helpme_***@yahoo.com> schreef in bericht
> news:uTDvPvEoGHA.4248@TK2MSFTNGP05.phx.gbl...
>> thanks.
>>
>>
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>> news:uWOlRlEoGHA.1236@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" <helpme_***@yahoo.com> schreef in bericht
>>> news:el2T4qDoGHA.4772@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.
>>>>
>>>
>>>
>>
>>
>
>