Results 1 to 13 of 13

Thread: Need Urgent Help Feeding A Picture Into code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Need Urgent Help Feeding A Picture Into code

    Ok, so here is my problem. I am making an email flyer for a barbeque. I need to know if people want hot dogs, burger, cheese, etc... I have made a form with check boxes next to each food item. What I want to do is :

    When the person clicks the check box, a picture of the food item pops up.

    If anyone knows a code or a way to compile a code to do this it would be greatly appreciated.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Need Urgent Help Feeding A Picture Into code

    Load pics of the food into picture boxes (make Visible = False when the form loads) next to the options then when a user ticks a certain food show the picture box then if they untick it hide the picture box. HTH

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Re: Need Urgent Help Feeding A Picture Into code

    Ok, I need to clear some things up. I have made 4 picture boxes now. Now, what is the code to have the picture show up when I click it and when I unclick it. Also, where is it exactly that I insert the picture. I clicked the lightning bolt because I know those are extra settings, but is that the right place? Or is it somewhere different and could you please tell me how to insert it to the Picturebox and then the code to use it in show/hide format.

    Thanks a very very much.

  4. #4
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Need Urgent Help Feeding A Picture Into code

    VB Code:
    1. 'chkPizza is the name of your check box
    2. 'picPizza is the name of your picture box
    3. If chkPizza.Value = 1 Then
    4. picPizza.Visible = True
    5.  
    6. ElseIf chkPizza.Value = 0 Then
    7. picPizza.Visible = False
    8.  
    9. End if

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Re: Need Urgent Help Feeding A Picture Into code

    Awesome thanks alot man. I really do appreciate it. You guys are not stuck up here on helping noobs like on some other sites.

    BUT: The code above I know is for the visibility and that stuff. But where is it that I insert the picture for the Picture Box?
    Last edited by LaxNasty; Nov 15th, 2006 at 07:00 PM.

  6. #6
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Need Urgent Help Feeding A Picture Into code

    Glad to help

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Re: Need Urgent Help Feeding A Picture Into code

    [Public Class Form1


    Private Sub chkHotDog_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkHotDog.CheckedChanged
    If chkHotDog.Visible = 1 Then
    picHotDog.Visible = True
    ElseIf chkHotDog.Visible = 0 Then
    picHotDog.Visible = False


    End If
    End Sub

    Private Sub picHotDog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles picHotDog.Click
    If chkHotDog.Visible = 1 Then
    picHotDog.Visible = True
    ElseIf chkHotDog.Visible = 0 Then
    picHotDog.Visible = False
    End If
    End Sub
    End Class]

    This is my code, but I can't seem to get it to work. My picture box is right next to the corresponding check box, and the Asychronus Initial Image has the picture of the food item I want. What is wrong here?

  8. #8
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Need Urgent Help Feeding A Picture Into code

    Check out the attached as it should get you going.
    Attached Files Attached Files

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Re: Need Urgent Help Feeding A Picture Into code

    So the above attached link, how am I exactly supposed to use it. The Word document set the different heights, widths, etc.. but I am unsure of where to start because there is a lot of different settings to set. So, should I make the form and add those settings? And where do I put the :
    If chkHotDog.Visible = 1 Then
    picHotDog.Visible = True
    ElseIf chkHotDog.Visible = 0 Then
    picHotDog.Visible = False
    End If

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Need Urgent Help Feeding A Picture Into code

    Moved to Classic VB forum seeing how the code examples are posted in VB 6 and seem to be what the thread poster wants.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  11. #11
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Need Urgent Help Feeding A Picture Into code

    Did you run my example?

    Did you click the check boxes 1 by 1 to see the corrisponding picture box appear?

  12. #12

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Re: Need Urgent Help Feeding A Picture Into code

    EDIT: Ok, it works. I will edit it to make the pics I want. Thank you so much. This taught me alot thnx.
    Last edited by LaxNasty; Nov 15th, 2006 at 08:13 PM.

  13. #13
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Need Urgent Help Feeding A Picture Into code

    There is no .DOC file in the zip file??
    Attached Images Attached Images  

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