|
-
Sep 21st, 2007, 10:49 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] save picture filename with common dialog
I have problem here. I want to save the image from picture box to my computer. I use common dialog, the filename is extract form text21. But When I change this filename to other filename, It save without extension *.jpg. But If I follow what the filename given, it save with extension *.jpg. How I use recommended filename or my own filename and save it with extension at the end of the filename.
Code:
'SAVE pest picture from picturebox to file
With CommonDialog2
.fileName = Text21.Text & ".jpg"
.Filter = "Image (*.*)|*.*"
.ShowSave
If Len(.fileName) <> 0 Then
SavePicture Picture2.Image, CommonDialog2.fileName
MsgBox "File berjaya disimpan di " & CommonDialog2.fileName
End If
End With
-
Sep 21st, 2007, 11:11 AM
#2
Member
Re: save picture filename with common dialog
hi please try as following
i hope this is what you are trying to achive if not please clarify further
it will show untitled.jpg as default if you are selecting option 1
if you are selecting option two will show all the jpg files
vb Code:
[CODE]
With CommonDialog2
.FileName = Text21.Text & ".jpg"
.Filter = "Preferred Image (untitled.JPG)|untitled.JPG|Image (*.jpg)|*.jpg|All Files (*.*)|*.*"
.ShowSave
If Len(.FileName) <> 0 Then
SavePicture Picture2.Image, CommonDialog2.FileName
MsgBox "File berjaya disimpan di " & CommonDialog2.FileName
End If
End With[/CODE]
-
Sep 21st, 2007, 11:34 AM
#3
Fanatic Member
Re: save picture filename with common dialog
Use this
Code:
Private Sub Command1_Click()
With CommonDialog2
.FileName = Text21.Text & ".jpg"
.Filter = "Image (*.jpg)|*.jpg"
.ShowSave
If Len(.FileName) <> 0 Then
SavePicture Picture2.Image, CommonDialog2.FileName
MsgBox "File berjaya disimpan di " & CommonDialog2.FileName
End If
End With
End Sub
Dont rely only on your luck. Work hard until You get success.
vb Code:
Private sub Time_ispassing
While Me.Notgetsuccess
trygain=tryagain+1
Me.workhard
wend
end sub
-
Sep 21st, 2007, 02:12 PM
#4
Re: [RESOLVED] save picture filename with common dialog
But you can't save a picture as a jpg it always saves as a bmp unless you are using Bmp2jpeg.dll. Do a search on here for Bmp2jpeg.dll.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
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
|