-
Hi. I'm writing a program where i'm using a common dialog box
- to open a random file. I have an error routine so i can grab the error
- when the user presses the cancel button. The cancel error option i
- checked in the dialog's properties, but i still get the error 32755 when
- the cancel button is pressed.The debugger points me to dialogbox.showOpen
- or Action = 1 whichever i use. Could someone help me?
It seems that there is something wrong with the properties.
Private Sub mnuFileOpen_Click()
grdGrid.Visible = True
On Error GoTo eh
diaClass.Flags = &H1000
Dim iHandle As Integer
Dim sClassRec As Class_Info
Dim iRow As Integer
iHandle = FreeFile
diaClass.FilterIndex = 2
'diaClass.Action = 1
diaClass.ShowOpen
diaClass.InitDir = ""
Open diaClass.FileName For Random As iHandle Len = Len(sClassRec)
Do Until EOF(iHandle)
Get #iHandle, , sClassRec
iRow = iRow + 1
With sClassRec
grdGrid.AddItem .sClassNo & Chr(9) & _
.sRoomNo & Chr(9) & _
.sUnit & Chr(9) & _
.sInstructor & Chr(9) & _
.sDay & Chr(9), _
iRow
End With
grdGrid.Rows = iRow + 1
Loop
Close iHandle
Exit Sub
eh:
If Err.Number = 32755 Then
Exit Sub
ElseIf Err.Number = 53 Then
MsgBox Err.Description
Else
MsgBox "Error! " & Err.Number & " " & Err.Description, , "Error!"
End If
End Sub
-
Try:
Code:
On Error Resume Next
This will just bypass the error.
-
on error goto QuitNow:
'set it's value to true
CommonDialog1.CancelError = True