Simple program with a picture box and a textbox.
A picture is shown.
The user enters a response into the textbox.
The program checks if the response was correct (Each picture having a correct answer).
If wrong, waits for correct input.
If correct, clear the textbox, and displays a new picture.
Assume about 50 pictures, each having a single unique ';answer';.
How would I go about coding this? How do I build arrays? How do I generate random numbers, and then choose a picture based on that generation? How do I clear the textbox?
Any tips?Need help coding in Visual Basic?
%26gt;%26gt; How do I build arrays?
Dim myArray() As String
Dim otherArray(10) As Integer
%26gt;%26gt; How do I generate random numbers,
Dim myRandom As New Random()
myRandom.Next(1, 1000) 'makes integer between 1 and 1000
%26gt;%26gt; and then choose a picture based on that generation?
Name the pictures 1-1000.jpg, put them all in the same directory, construct a string for the path to the image (e.g., Dim strPath as String = ';c:\pics\'; %26amp; myRandom %26amp; ';.jpg';, assign the picturebox control's imagelocation attribute as that string, e.g., PB1.ImageLocation = strPath
%26gt;%26gt;How do I clear the textbox?
TextBox1.Text = String.Empty
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment