|
-
Apr 11th, 2005, 08:54 AM
#1
Thread Starter
Fanatic Member
using same DriveListBox for multiple uses?
On my form I have a DriveListBox, DirListBox, FileListBox, two text fields, txtFile1 and txtFile2 and two picture boxes Picture 1 and Picture 2. What I want to do is use the same controls to load a jpg image into picture1 and another jpg image into picture2. I have my controls to setup to load my image into picture1. How do I reset the controls so I can add another image into Picture2?
VB Code:
'//////////// SELECT FOLDER FROM DRIVE //////////////////////
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
'//////// SELECT DRIVE LETTER FROM LOCAL HARD DRIVE /////////////////
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
'/////////// PUT FILE NAME INTO TEXT BOX
Private Sub File1_Click()
Dim txtPath$
txtPath$ = Dir1.Path
If Mid(txtPath$, Len(txtPath$), 1) = "\" Then
txtFile1.Text = Dir1.Path & File1.FileName
Else
txtFile1.Text = File1.FileName
End If
Picture1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
End Sub
He who never made a mistake never made a discovery?
-
Apr 11th, 2005, 08:56 AM
#2
Re: using same DriveListBox for multiple uses?
Create a Boolean. If the boolean is true, then Picture1 already has a picture, load it into Picture2.
-
Apr 11th, 2005, 11:50 AM
#3
Thread Starter
Fanatic Member
Re: using same DriveListBox for multiple uses?
Thanks for the quick reply, I made a global bolean called "bolsmallPhoto" and I also made to global varibles smPhoto and lgPhoto as Strings. When my form loads I set the bolsmallPhoto = false. I then changed my code to this, and so far everything is working.
What I want to know now is, when I select the small photo and it is correct, I need the file1.list box to clear itself. I tried File.Refresh, but that doesn't really clear the box out. How can I do that?
VB Code:
Private Sub File1_Click()
Dim txtPath$
txtPath$ = Dir1.Path
Dim Msg ' Declare variable.
If bolsmallPhoto = False Then
If Mid(txtPath$, Len(txtPath$), 1) = "\" Then
txtFile1.Text = Dir1.Path & File1.FileName
Else
txtFile1.Text = File1.FileName
End If
Picture1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
Msg = "Is this small photo correct?"
If MsgBox(Msg, vbQuestion + vbYesNo, Me.Caption) = vbYes Then
smPhoto = Dir1.Path & "\" & File1.FileName
bolsmallPhoto = True
txtFile2.Visible = True
Picture2.Visible = True
Label2.Visible = True
File1.Refresh
Else
bolsmallPhoto = False
Exit Sub
End If
Else
If Mid(txtPath$, Len(txtPath$), 1) = "\" Then
txtFile2.Text = Dir1.Path & File1.FileName
Else
txtFile2.Text = File1.FileName
End If
Picture2.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
Msg = "Is this large photo correct?"
If MsgBox(Msg, vbQuestion + vbYesNo, Me.Caption) = vbYes Then
lgPhoto = Dir1.Path & "\" & File1.FileName
File1.Refresh
Else
Exit Sub
End If
End If
End Sub
He who never made a mistake never made a discovery?
-
Apr 11th, 2005, 11:55 AM
#4
Re: using same DriveListBox for multiple uses?
 Originally Posted by Navarone
What I want to know now is, when I select the small photo and it is correct, I need the file1.list box to clear itself. I tried File.Refresh, but that doesn't really clear the box out. How can I do that?
The filelist box doesn't have a .Clear method like the listbox, so I'd suggest feeding it a pattern you know doesn't exist. Something like
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
|