|
-
July 22nd, 2000, 01:10 PM
#1
Arrays of Picture Objects
I have set up an array of Picture Objects using the code
private Sub Form_Load()
public gifObjects (1 to 4) as Picture
set gifObjects (1) = LoadPicture ("c:Apps\one.gif")
set gifObjects (2) = LoadPicture ("c:Apps\two.gif")
set gifObjects (3) = LoadPicture ("c:Apps\three.gif")
set gifObjects (4) = LoadPicture ("c:Apps.four.gif")
End Sub
I have a TextBox on one Form which can hold numbers form 1 to 4. I would like to have some code to state that if the TextBox.Text = 1 Then load gifObjects(1) into the PictureBox I have called picGIFs. If TextBox.Text = 2 Then load gifObjects(2) etc.
The TextBox is on one form and the PictureBox is on a second form. Will this be an additional problem?
Has anyone got any suggestions?
MTS
-
July 22nd, 2000, 02:20 PM
#2
Re: Arrays of Picture Objects
Picgif must have Autoredraw = true. Ths following code goes into Form1
Option Explicit
Dim gifObjects(1 To 4) As Picture
Private Sub Command1_Click()
Load Form2
Form2.picGif.Picture = gifObjects(Text1.Text)
Form2.Show
End Sub
Private Sub Form_Load()
Set gifObjects(1) = LoadPicture("c:\windows\Cloud.gif")
Set gifObjects(2) = LoadPicture("c:\windows\Content.gif")
Set gifObjects(3) = LoadPicture("c:\windows\hlpCd.gif")
Set gifObjects(4) = LoadPicture("c:\windows\Hlpglobe.gif")
Text1 = 1
End Sub
John G
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|