Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27445

VS 2010 How to set the File Name when saving an Image

$
0
0
Hi All,

Hopefully someone can provide me with an answer to what i expect is a very simple question, but i seem to be having no luck with ...

When saving an Image, i want to use the text in Textbox1 as the File Name.
I know you can set the FileName through the Properties tab of the SaveFileDialog, but the FileName will need to be specified by the user each time the application is used.

Below is the code being used for the Save Button at the moment

Thanks !




Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

Dim data As IDataObject
Dim bmap As Image
Dim JobNumber As String = TextBox1.Text
Dim SaveFile As New SaveFileDialog


SendMessage(hHwnd, WM_CAP_EDIT_COPY, 0, 0)
data = Clipboard.GetDataObject()

If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
picCapture.Image = bmap
ClosePreviewWindow()
btnSave.Enabled = False

If sfdImage.ShowDialog = DialogResult.OK Then
bmap.Save(sfdImage.FileName, Imaging.ImageFormat.Bmp)
End If
End If
End Sub

Viewing all articles
Browse latest Browse all 27445

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>