|
-
Nov 4th, 2001, 03:42 PM
#1
Thread Starter
Hyperactive Member
Super easy question
Hi,
I have a picturebox and a command button titled browse. How do I make it so when i click on the cmd button, it brings up the dialogue box where i can select a file? Also, when I select a .bmp image and click ok, how do i load it into the picture box?
thanks in advacne
Visual Basic 6, HTML, JavaScript, learning C++
-
Nov 4th, 2001, 03:51 PM
#2
Add a reference to the MS Common Dialog Control, add one to the form, and use something like this:
VB Code:
'CD1 = CommonDialog
Private Sub cmdBrowse_Click()
CD1.Filter = "*.bmp"
CD1.ShowOpen
Picture1.Picture = LoadPicture(CD1.FileName)
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 4th, 2001, 03:52 PM
#3
Lively Member
like dis, aye
VB Code:
CommonDialog1.Filter = "Bitmap (*.bmp)|*.bmp"
CommonDialog1.ShowOpen
If Len(CommonDialog1.FileName) > 0 Then
Picture1.Picture = LoadPicture(CommonDialog1.FileName)
End If
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
|