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

VS 2010 Save Problem

$
0
0
I've created this save function but it doesn't work the way that it's supposed to. First of all, whenever I bring in an image, save it and open the saved image, nothing happens, this confuses me simply because a file IS created but contains nothing. Secondly, whenever I try to save the image as a TIFF, it constsntly says that the filenemae is invalid. Can anyone help me with this problem?

Code:

Private Sub FileSaveAs_Click(sender As System.Object, e As System.EventArgs) Handles FileSaveAs.Click
        SaveFileDialog.AddExtension = True
        SaveFileDialog.DefaultExt = Path.GetExtension(SaveFileDialog.FileName)
        If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            Try
                Select Case SaveFileDialog.FilterIndex
                    Case 1
                        picImage.Image.Save(SaveFileDialog.FileName,System.Drawing.Imaging.ImageFormat.Bmp)
                    Case 2
                        picImage.Image.Save(SaveFileDialog.FileName,System.Drawing.Imaging.ImageFormat.Gif)
                    Case 3
                        picImage.Image.Save(SaveFileDialog.FileName,System.Drawing.Imaging.ImageFormat.Jpeg)
                    Case 4
                        picImage.Image.Save(SaveFileDialog.FileName,System.Drawing.Imaging.ImageFormat.Png)
                    Case 5
                        picImage.Image.Save(SaveFileDialog.FileName,System.Drawing.Imaging.ImageFormat.Tiff)
                End Select
            Catch ex As Exception
                MsgBox("There is no image to save.")
            End Try
        End If
    End Sub


Viewing all articles
Browse latest Browse all 27333

Trending Articles



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