468,135 Members | 1,436 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,135 developers. It's quick & easy.

Code For Loading a pic into a picture box

11
im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but it can sumtimes be the same but the number will be from 1 - 6 and if it = 1 then i have a pic of a dice face that has a number 1 on it and if it = 2 then a dice pic with 2 on it and so on but i dont kno how to get it to do any of that i was using like select case but im stuck plz help
Jul 31 '07 #1
3 1533
rd301
7
im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but it can sumtimes be the same but the number will be from 1 - 6 and if it = 1 then i have a pic of a dice face that has a number 1 on it and if it = 2 then a dice pic with 2 on it and so on but i dont kno how to get it to do any of that i was using like select case but im stuck plz help
hello

kindly tell which language u r using for pragramming.

RD
Jul 31 '07 #2
im trying to do this assignment for skool and i have completely forgot how to do this. i have 2 pic boxes and 1 button wen i click that button i want it to get a random number diff one for both but it can sumtimes be the same but the number will be from 1 - 6 and if it = 1 then i have a pic of a dice face that has a number 1 on it and if it = 2 then a dice pic with 2 on it and so on but i dont kno how to get it to do any of that i was using like select case but im stuck plz help
Example from my project. I get this code from online friends.

[HTML]
Private Sub HidePicture()

Dim MyCondition As Integer

If cmbShape = "Angle" Then
MyCondition = 1
ElseIf cmbShape = "Circle" Then
MyCondition = 2
ElseIf cmbShape = "Circular Tube" Then
MyCondition = 3
ElseIf cmbShape = "Hexagon (A/F)" Then
MyCondition = 4
ElseIf cmbShape = "Hexagon (A/C)" Then
MyCondition = 5
ElseIf cmbShape = "Hollow Rectangle" Then
MyCondition = 6
ElseIf cmbShape = "I-Beam" Then
MyCondition = 7
ElseIf cmbShape = "Octagon (A/F)" Then
MyCondition = 8
ElseIf cmbShape = "Octagon (A/C)" Then
MyCondition = 9
ElseIf cmbShape = "Rectangle" Then
MyCondition = 10
ElseIf cmbShape = "Square" Then
MyCondition = 11
ElseIf cmbShape = "Tee Section" Then
MyCondition = 12
ElseIf cmbShape = "U-Channel" Then
MyCondition = 13
Else
End If

Show_PBox MyCondition

End Sub

Sub Show_PBox(Index As Integer)

' Hide all pictureboxes
Dim i As Integer
For i = 0 To 12
picShape(i).Visible = False
Next i

' Show the requested picturebox
picShape(Index - 1).Visible = True

End Sub
[/HTML]
Jul 31 '07 #3
Zaccy
11
i am using visual basic
the newest one
and i need the coide to load a file from like a folder in my computer code in the old visual basic 6.0 it is like ::


Randomize
Select Case Int(Rnd * 6)+1

Case 1
picboxname.picture = LoadPicture(app.path & \picname.bmp)

and so on
but i need the code for the new version as this dont work
thanx heaps
Aug 1 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

15 posts views Thread by Geoff Cox | last post: by
3 posts views Thread by Nathan | last post: by
6 posts views Thread by Alvaro G. Vicario | last post: by
6 posts views Thread by Ivan Bútora | last post: by
1 post views Thread by Phil Stanton | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.