help about ms common dialog
all i want to know is how to use microsoft common dialog,so here is the scheme on what i want to make. check below
1.How to set a comman like when a user press the browse button a browse dialog will pop up and it has a open button and a cancel button and also user can only browse only a jpg and a jpeg file extension.
2.How to set a command,When the user click the jpg or jpeg file extension or in short a image then a user hit the open button the image that user select from the browse dialog should be in the Image Box.
3.How to set a command like when a user hit the save button, the image in Image Box should be save or atleast copy to the /Student Picture folder and rename as "MyDefaultPicture".
Thats all i want to know,Please help me.
Any help will appreciated. thanks
Re: help about ms common dialog
This question been asked many number of times this week. I can give you the answer but do a search on the forums and you will find plenty of examples :)
Don't let the 'Search' utility of VBF go for a waste ;)
Re: help about ms common dialog
Re: help about ms common dialog
oh thanks koolsid such a sweet sample ..will now i want to make it simple like when a user hit the save button, the Picture in the ImageBox will be save automatically right after a user press the save button and the file will be named as what user put name on the filename.Text.So what command should i put?.
please help me.
Re: help about ms common dialog
Show me the code that you have tried till now...
Re: help about ms common dialog
Code:
Image1.Picture SavePicture("C:\")
but i got a error sayin' type mismatch' ..but honestly i dont know what command of it should i set. but im trying my best to make it. I want to save the image in the imagebox which came from d:\ that i browse using common dialog open window to c:\ and rename the file as "mypicture".
Re: help about ms common dialog
Is this what you are trying?
Code:
'~~> ShowSave Example
Private Sub Command3_Click()
On Error GoTo cancel_error
With CommonDialog1
'~~> Set the Title of the Dialog Box
.DialogTitle = "Save"
'~~> Set the Initial directory
.InitDir = "C:\"
'~~> Set the Filter for the files that you want to save as
.Filter = "Image Files (*.bmp)|*.Bmp|All Files (*.*)|*.*"
'~~> Displays the Save Dialog Box
.ShowSave
End With
'~~> Save the Image1 Picture as bmp
SavePicture Image1.Picture, CommonDialog1.FileName
Exit Sub
cancel_error:
If Err.Number <> vbCancel Then
MsgBox Err.Description
End If
End Sub
Re: help about ms common dialog
ok ,thanks , i got it , and in saving the picture method is i would not use common dialog as a saving function, thus i use a simple method such this
Code:
SavePicture Image1.Picture 'missing here,how can i specify the saving path of a image and the name of it'?
is there anyway to it as a .jpg file extension .. not bmp? .
THANKS AGAIN MR.KOOLSID
Re: help about ms common dialog
Code:
SavePicture Image1.Picture, "C:\MyFile.Bmp"
Re: help about ms common dialog
Quote:
is there anyway to it as a .jpg file extension .. not bmp? .
THANKS AGAIN MR.KOOLSID
You can save the file with whatever name and extension. But the content will be the actual one. For example, if you are saving the BMP file in a JPG extension, it doesn't mean that you have converted the image to JPG format (compressed). The content will be same the BMP file. But some picture viewers are able to recognize the picture and they will open it for you, even it is in JPG extension.
So, technically, if you want to convert the picture to JPG format, you have to use some coding for the conversion.
That's what I think. Good luck...:thumb:
Re: help about ms common dialog
lolzzzz... I m missed that...
Re: help about ms common dialog
Re: help about ms common dialog
Quote:
Originally Posted by
Condomx
is there anyway to it as a .jpg file extension .. not bmp? .
Do a search on here for BMP2JPEG.dll ;)