View Single Post

Visual Studio/Basic Express help
Old 04-20-2009, 03:11 PM   #1
zonic505
Persona!!
 
zonic505's Avatar
 
zonic505 is offline
Join Date: Apr 2007
Location: .......People actually read this?
Posts: 3,717
Marketplace Rating: 0
Send a message via PM  to zonic505
ZonikuX Zonic505 Zonic
Question Visual Studio/Basic Express help

I downloaded Visual Basic Express on my laptop so I could work on some projects that I'm doing for Programming on Visual Studio at school & I need some quick help.

I'm making a program that plays Rock, Paper, Scissors & I've got about 1/2 of it done (have it so each of the 3 buttons brings up a pic of a rock, paper, or scissor). What I need help on are 2 things:

1.) Make it so the computer will randomly choose a number from 1, 2, & 3, each of which will be assigned a picture so that each time I click a button from my side, the computer will randomly pick a number, resulting in a picture being brought up.

2.) Make it so that if I were to win, the text box will say "You Win", & all that stuff, to which I think I need to make it something along the lines of "If PictureBox1.Image = BmpImage1 & PictureBox2.Image = bmpImage2, Then "You Win" or something along those lines (I know it won't be exactly typed like that).

Here's my code so far:

Quote:
Public Class Form1
Dim MyValue As Long

Dim X As Integer
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim bmpImage1 As New Bitmap("*location of picture*")
PictureBox1.Image = bmpImage1

End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim bmpImage2 As New Bitmap("*location of picture*")
PictureBox1.Image = bmpImage2

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim bmpImage3 As New Bitmap("*location of picture*")
PictureBox1.Image = bmpImage3

End Sub

Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click

Randomize() ' Initialize random-number generator.

MyValue = Int((3 * Rnd()) + 1) ' Generate random value between 1 and 3.

TextBox1.Text = MyValue
End Sub
End Class
I can't get it work since the pictures are saved at my school, but I can still work on it from here. Any help would be appreciated.

If anyone can help me so that I can take a picture of my screen (that screencap thing or whatever it is), then I can show a pic of what I'm doing.

Last edited by zonic505 : 04-20-2009 at 03:17 PM.
  Reply With Quote