Results 1 to 6 of 6

Thread: [2005] loading a picture into a picture box..

  1. #1

    Thread Starter
    Addicted Member noam309's Avatar
    Join Date
    Aug 2006
    Posts
    225

    Question [2005] loading a picture into a picture box..

    hi,

    I have 2 pictures in my app directory , 2 radio buttons and a picture box
    I want that with choose the first button it will load the picture into the picture box , and if choose the second button it will load the second picture
    ,it's suppose to be very simple but , I didn't manage to do it ,
    so please help.

    Giving an exact answer
    Saves a lot of time!!!

  2. #2
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: [2005] loading a picture into a picture box..

    VB Code:
    1. if radiobutton1.Checked = True then
    2.    picturebox1.Load(application.StarupPath & "\image1.jpg")
    3. elseif radiobutton2.checked = true then
    4.    picturebox2.load(application.StarupPath & "\image2.jpg")
    5. end if
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  3. #3

    Thread Starter
    Addicted Member noam309's Avatar
    Join Date
    Aug 2006
    Posts
    225

    Question Re: [2005] loading a picture into a picture box..

    I put this code in the radio button and it says-
    "load is not a member of windows forms application , what does it mean?

    and another thing that doesn't fit is-
    I want to use only one picturebox ,and with choose of one radio button it will load the picture in the same picturebox for both radio buttons...
    Last edited by noam309; Aug 27th, 2006 at 04:05 PM.

    Giving an exact answer
    Saves a lot of time!!!

  4. #4
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,521

    Re: [2005] loading a picture into a picture box..

    I don't have the ide in front of me, so use visual studios intelisense. It's either load, or loadfile. Instead of just copying and pasting the code, look at it and see what it does. This should be easy enough for you to convert into what you want.
    Quote Originally Posted by noam
    Giving an exact answer Saves a lot of time!!!"
    But you don't learn anything because you copy and paste the code and don't look at what it does.
    Visual Studio Team Edition 2005
    GDI+ Links: Bob Powell VB.Net Heaven
    API Links: All API Pinvoke.Net
    VB6 to VB.Net: Visual Basic 6 to .NET Function Equivalents (Thread)

  5. #5
    PowerPoster VBDT's Avatar
    Join Date
    Sep 2005
    Location
    CA - USA
    Posts
    2,922

    Re: [2005] loading a picture into a picture box..

    try this
    VB Code:
    1. If Me.radiobutton1.Checked = True Then
    2.             Me.PictureBox1.Image = New Bitmap(My.Application.Info.DirectoryPath & "\image1.jpg")
    3.         ElseIf Me.radiobutton2.checked = True Then
    4.             Me.PictureBox1.Image = New Bitmap(My.Application.Info.DirectoryPath & "\image2.jpg")
    5.         End If

  6. #6

    Thread Starter
    Addicted Member noam309's Avatar
    Join Date
    Aug 2006
    Posts
    225

    Smile Re: [2005] loading a picture into a picture box..

    Thank you for your reply ,
    I'll check this code when I arrive home,

    and by the way - mpdeglau ,
    I do learn from codes! I wrote a very nice applications using VB6 ,and also I learned it from codes.
    of course it is nice to add an explanation for what you're doing but after I get the code , and combine it with my app. I write remarks , explaning how it works.
    Some day I'll be very helpfull here.

    Giving an exact answer
    Saves a lot of time!!!

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