472,805 Members | 914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

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 1673
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

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

Similar topics

2
by: Mark Richards | last post by:
An applet on one of my pages uses a big picture as background. I want to load it before the applet and the rest of the html source. By doing this I want to avoid that the pane of the applet is...
15
by: Geoff Cox | last post by:
Hello I have following type of code in the header function pre_load_pics() { if (document.images) { var image1 = new Image(400,265); image1.scr = "pic1.jpg";
6
by: John Ortt | last post by:
Hi there everyone, I have a part info form which has a faded image of our company logo as a background. I want to replace the faded image with a bright red warning image on items which have run...
3
by: Nathan | last post by:
Hi, I have a project with various forms that each include a number of picture boxes and panels with background images. When these forms first load, they kind of load in "pieces", with the...
6
by: snazzy | last post by:
I have a problem where using innerHTML to rewrite a DIV or removeChild to kill a DIV that either of them, if excuted before the page is done loading will stop the page in its tracks. ...
6
by: Alvaro G. Vicario | last post by:
The code below inserts a <spantag around the image. It works fine in Firefox or Opera, but has a weird effect in Internet Explorer: browser keeps loading the image forever... Even though the...
6
by: Ivan Bútora | last post by:
I have recently looked at http://alistapart.com/articles/imagegallery to implement a simple picture gallery on a webpage that I'm working on. Everything works fine; however, I have one question....
3
by: mpratheepa | last post by:
How to get a picture file (*.jpg extension) in Image tool box in the form during run time. I used Image1.Picture = LoadPicture(photoname) photoname is from table which contains file name...
1
by: Phil Stanton | last post by:
Is there any way of stopping the cursor jumping to a point roughly in the middle of the screen when loading a new picture into an Image Control. The picture is linked and pulled from an external...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.