Image producing

Posted on 2006-03-21
Last Modified: 2010-04-07
Hello Experts,

I am using visual basic 6.0 on micrisoft XP platform...having not much Idea about using VB 6.

But ,I have created direct buttons and some text area's,filled up informnation and now I would like to have Images in front of those buttons.

important is ,how I will see image in image box not the file path..

(everytime when I change information I can see the same picture not appropriate to information.)

Will you please tell me how to do it?

Question by:rachelee

    Author Comment

    Hello Again,

    Now I am able to see the file name in the image box, and when I click on it then only i am able to see an image ,
    but I would like to see it without clicking....Infact i would not like to see file name but picture.

    please need ur help

    best regards
    LVL 17

    Expert Comment

    I've read that 5 times and I'm not still not sure what you're asking. Maybe I'm just very sleepy.. :-(

    I normally don't ask this, but could you upload a screenshot of your form?

    Author Comment

    Yes I can explain again,

    I have some data in front of that I want to have the appropriate picture for that specific data.

    I am able to do it , but i can't see the picture in the box but file,
    will u please help me having direct picture in the box and not the file name where picture is saved...

    when I click on file name in the box , I am able to see picture from   microsoft picture.

    please ask me againg if u do not understand yet


    LVL 17

    Accepted Solution

    It'd probably help me understand your goal if you uploaded a screenshot (picture) of your form so I can see it. I'm having difficulty understanding the terms you're using.

    If you can't do that, then what exactly are you trying to do?

    Here are examples of loading a picture into a PictureBox control:

    Private Sub Command1_Click()
        'load the picture from Text1.Text ("c:\test.bmp")
        Set Picture1.Picture = LoadPicture(Text1.Text)
    End Sub
    Private Sub Command2_Click()
        'load the picture directly from path
        Set Picture1.Picture = LoadPicture("c:\test.bmp")
    End Sub

    This one will load pictures selected from a FileListBox:

    Private Sub File1_Click()
        'check file extension.. only allow BMPs
        If StrComp(Right$(File1.FileName, 4), ".bmp", vbTextCompare) = 0 Then
            Set Picture1.Picture = LoadPicture(File1.Path & File1.FileName)
        End If
    End Sub
    Private Sub Form_Load()
        File1.Path = "c:\"
    End Sub

    Author Comment

    I have a screen like below

     directory path of picture

    specification 1               data 1                               picture box>>in which i can see again path but i would like to see an  image

    specification 2               data 2                                And whenever I change data , specification and path of image in the next                                                                      page , the related picture should come next page.

    specification 3               data 3

    I hope r following now, what i want.

    thnx a lot

    LVL 17

    Expert Comment

    >> picture box>>in which i can see again path but i would like to see an  image
    I'm not clear on that.

    Why is the "path" displayed in the PictureBox? What control is used for "directory path"? Have you properly resized/moved the controls so they're not covering eachother?

    If you're new to VB, you might want to familiarize yourself with it a little and ask smaller questions. It's difficult for me to suggest anything right now for something unclear and broad.

    I'm heading out right now so I'll respond later today unless somebody else answers your question. As for the screenshot, I meant for you to take an actual picture of how your form looks... it'd really help for others and myself to help you.
    LVL 48

    Expert Comment

    by:Ryan Chong
    >>now I would like to have Images in front of those buttons.
    If you're using standard command buttons, you can try change its Style Property to 1 - Graphical, and then at the Picture Property click the "[...]" button (when you focused on that Property) to select an image. If you want to load the image dynamically, you can try use the LoadPicture function as what zzzzzooc mentioned above.

    Let us know if you need further helps here.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now