Results 1 to 7 of 7

Thread: [RESOLVED] loading a picture into a picturebox...

  1. #1

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

    Resolved [RESOLVED] loading a picture into a picturebox...

    Hi ,

    I have 2 radiobuttons and 1 picturebox

    when choose radiobutton 1 I want to load picture1 into the picturebox
    and when choose radiobutton 2 I want to load picture2 into the same picturebox .

    I have tried this:
    Code:
    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
            If RadioButton2.Checked = True Then
                PictureBox1.Load(Application.StarupPath & "\T.jpg")
            End If
        End Sub
    but as you probably understand it doesn't work ,Why?!
    please need your quick respond.

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

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: loading a picture into a picturebox...

    whats happening, are you getting any error messages. if so add a try catch.
    try adding picturebox1.refresh() or update()
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  3. #3

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

    Question Re: loading a picture into a picturebox...

    NO, Sorry I didn't understand.

    Can you write this line of code , I'm sort of a new in vb Net.

    it tells me that -" Application.StarupPath " is not a member of ...

    It suppose to be easy - How should I load a picture with button click into a picturebox , ( if the picture should be in a spesific path like - D:\PIC\ , so it can be , but I don't know how to do it , please all the exepert here-could you answer?!

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

  4. #4
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: loading a picture into a picturebox...

    heres how to do it in visual studio 2003

    Dim l_bmp As Bitmap
    Try
    l_bmp = New Bitmap("\My Document\ba.jpg")
    PictureBox1.Image = l_bmp
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  5. #5

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

    Question Re: loading a picture into a picturebox...

    It gives an error:

    " An error message cannot be displayed because an optional resource assembly contaning it cannot be found"

    this is what I've done:
    Code:
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Dim l_bmp As Bitmap
            Try
                l_bmp = New Bitmap("D:\PIC\L10.jpg")
                PictureBox1.Image = l_bmp
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
    
        End Sub
    Whats wrong??

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

  6. #6
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: loading a picture into a picturebox...

    there is no d: drive on a PDA Device
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  7. #7

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

    Resolved Re: loading a picture into a picturebox...

    You are right !!! it works just fine!


    Maybe you could solve my second question for cab make , it is in a new thread, as it suppose to be.

    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