Results 1 to 4 of 4

Thread: Lostfocus event for Picture box.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2008
    Posts
    204

    Lostfocus event for Picture box.


    Private Picture_Boxes() As MyDevicePage_Picturebox

    Private Sub MySkanPage_Picturebox_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick

    MyBase.BorderStyle = Windows.Forms.BorderStyle.FixedSingle
    End Sub

    Private Sub MySkanPage_Picturebox_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LostFocus
    MyBase.BorderStyle = Windows.Forms.BorderStyle.None
    End Sub
    Hi friends,
    I am adding pictureboxes to my form as shown in the code above. but the problem is lostfocus event is not working. Can anybody tell me were the problem is.Thanks in advance.
    Regards,
    Susheelss

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Lostfocus event for Picture box.

    First up, you should generally handle the Enter and Leave events of a control rather than the GotFocus and LostFocus events. Apart from that, a PictureBox can't receive focus in the first place so it's not going to raise any of those four events.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2008
    Posts
    204

    Re: Lostfocus event for Picture box.

    Thanks Mr.jmcilhinney. If that is the case with picture box then how can i change the image of the picture box clicked and change the image of any other picture box containing same image to any other as in case of option buttons.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Lostfocus event for Picture box.

    The PictureBox has a Click event. It just doesn't receive focus when you click it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width