CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Sep 2011

    Unhappy Help me with this code...I have just started Learning VB6!

    This is my 4th code and it's a mixture of Image Box,Label Box and 4 option buttons. I have written the code but i'm getting a error as "Object Required". My code is as Follows:

    The Question is choose a Option of your pet and with that the required image will also be displayed!

    Private Sub OptDog_Click()
    Image1.Picture = LoadPicture("C:\Users\PC\Desktop\germanshepherd.jpg")
    End Sub
    Private Sub OptCat_Click()
    Image2.Picture = LoadPicture("C:\Users\PC\Desktop\lacykittens.jpg")
    End Sub
    Private Sub OptParrot_Click()
    Image3.Picture = LoadPicture("C:\Users\PC\Desktop\parrotcracker.jpg")
    End Sub
    Private Sub OptGuinneaPig_Click()
    Image4.Picture = LoadPicture("C:\Users\PC\Desktop\guineapig.jpg")
    End Sub

  2. #2
    Join Date
    Jun 2005
    JHB South Africa

    Re: Help me with this code...I have just started Learning VB6!

    On which line does it highlight this error..

    I suspect that it cannot find the image....

    BTW: please use code tags - [code] Your code [/code]
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  3. #3
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: Help me with this code...I have just started Learning VB6!

    You said you have image box as in one image box and 4 option buttons but your code is referencing 4 image boxes. If your intent is to change the picture when the option is selected then you need to change the code to point to the image box that actually exists in all cases. i.e. Image1
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.