Variable PictureBox

wwfc_barmy_army

New member
Joined
Apr 18, 2008
Messages
3
Programming Experience
Beginner
Hello, i have this code:

VB.NET:
        TextBox1.Visible = False
        Dim RandomNumber As Integer
        RandomNumber = RandomClass.Next(1, QuestionAmount)

        RandomQuestion = RandomNumber.ToString


        '
        'PictureBox1
        '
        Me.PictureBox1.Image = New System.Drawing.Bitmap("\pictures\" & RandomQuestion & ".jpg")

I am getting this error on the last line:

Parameter is not valid.

The variable 'RandomQuestion contains a number, either 1,2 or 3 at the moment, and i have images 1.jpg, 2.jpg and 3.jpg which is in the pictures folder.

How can i do this?

Thanks.
 
Back
Top