ð
Master Visual Basic .NET and Access Database By Building the Point Of
Sale System (POS).
ðē Enroll Now: https://bit.ly/2WcbRhX
[Screenshot]
[YouTube]
P.S. ~ Thanks for watching and I hope you found this video useful! please don’t forget to like, comment, subscribe and turn your notifications ON to be sure not to miss my next video.
[Source Code]
Private Sub btnSaveAs_Click(sender As Object, e As EventArgs) Handles btnSaveAs.Click
Dim sfdPic As New SaveFileDialog()
Dim Path As String = "C:\My Folder with SPACES\"
Dim Dir As String = System.IO.Path.GetDirectoryName(Path)
Dim title As String = "Code A Minute - iBasskung."
Dim btn = MessageBoxButtons.YesNo
Dim ico = MessageBoxIcon.Information
Try
If Not System.IO.Directory.Exists(Dir) Then
System.IO.Directory.CreateDirectory(Dir)
End If
With sfdPic
.Title = "Save Image As"
.Filter = "Jpg, Jpeg Images|*.jpg;*.jpeg|PNG Image|*.png|BMP Image|*.bmp"
.AddExtension = True
.DefaultExt = ".jpg"
.FileName = "myPicture-.jpg"
.ValidateNames = True
.OverwritePrompt = True
.InitialDirectory = Dir
.RestoreDirectory = True
If .ShowDialog = DialogResult.OK Then
If .FilterIndex = 1 Then
pbxProPic.Image.Save(sfdPic.FileName, Imaging.ImageFormat.Jpeg)
ElseIf .FilterIndex = 2 Then
pbxProPic.Image.Save(sfdPic.FileName, Imaging.ImageFormat.Png)
ElseIf .FilterIndex = 3 Then
pbxProPic.Image.Save(sfdPic.FileName, Imaging.ImageFormat.Bmp)
End If
Else
Return
End If
End With
If CheckBoxOpenImage.Checked Then
Dim r As DialogResult
Dim msg As String = "The image was saved successfully." & vbNewLine
msg &= "Do you want to open it now?"
r = MessageBox.Show(msg, title, btn, ico)
If r = System.Windows.Forms.DialogResult.Yes Then
Dim startInfo As New ProcessStartInfo("mspaint.exe") ' ^_^
startInfo.WindowStyle = ProcessWindowStyle.Maximized
startInfo.Arguments = Chr(34) & Dir & Chr(34) & "\" & System.IO.Path.GetFileName(sfdPic.FileName).ToString()
Process.Start(startInfo)
Else
Return
End If
End If
Catch ex As Exception
MessageBox.Show("Error: Saving Image Failed ->> " & ex.Message.ToString())
Finally
sfdPic.Dispose()
End Try
End Sub
★✩★ Follow me on ★✩★
Twitter
Facebook
Google+
YouTube Channel
Thank you very much.
āļāļāļāļุāļāļāļĢัāļ.
I really loved reading your blog. It was very well authored and easy to undertand. Unlike additional blogs I have read which are really not tht good. I also found your posts very interesting. In fact after reading, I had to go show it to my friend and he ejoyed it as well! psiprograms.com
ReplyDeleteThere is a error in' r = MessageBox.Show(msg, title, btn, ico)' error under .Show 'how to fix it.
ReplyDelete