Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21237

[RESOLVED] how to check if a filename is empty In CommonDialog1 before saving

$
0
0
i am trying to display a msgbox that if a filename is empty then a user needs to enter some name for this picture
i cant figure it out
this is my code
Code:

  Dim bm As Image
    SendMessage hHwnd, WM_CAP_EDIT_COPY, 0, 0
    ClosePreviewWindow
    PaintPictureWithPreserveAspectRatio picCapture, Clipboard.GetData
    CommonDialog1.CancelError = True
    CommonDialog1.FileName = ""
    CommonDialog1.Filter = "All Picture Files|*.bmp;*.jpg;*.gif;*.png|JPEG (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|Graphics Interchange Format (*.gif)|*.gif|Portable Network Graphic (*.png)|*.png"
    On Error GoTo NoSave
    CommonDialog1.ShowSave
      If Len(CommonDialog1.FileName) <> 0 Then
    MsgBox "Please choose a name for this picture", vbInformation
    End If
    SavePicture picCapture.Image, CommonDialog1.FileName
NoSave:
    cmdSave.Enabled = False
    cmdStart.Enabled = False
    TakePic.Enabled = False
    clear.Enabled = False
    BttnnCancel.Enabled = True
  Call OpenPreviewWindow


Viewing all articles
Browse latest Browse all 21237

Trending Articles



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