VB Code:
  1. If opt_txt.Value = True Then
  2.                 CommonDialog1.DialogTitle = "Save Log File"
  3.                 CommonDialog1.Flags = cdlOFNHideReadOnly
  4.                 CommonDialog1.Filter = "Text Files (*.txt)|*.txt|"
  5.                 CommonDialog1.FilterIndex = 1
  6.                 CommonDialog1.ShowSave
  7.                 file_inidir = "C:\Program Files\FYP System\Log File\" & user_reg.txt_username
  8.                 CommonDialog1.InitDir = file_inidir
  9.                 If CommonDialog1.FileName = "" Then
  10.                     Timer1.Enabled = False
  11.                     Exit Sub
  12.                 Else
  13.                 show_dir = CommonDialog1.FileName
  14.                 End If
  15.         end if

when i choose the CANCEL button, suppose it do not do anything.....
but it still save the data into a file!!!
so, how to settle this problem?