I always get a runtime error 32755 
Author Message
 I always get a runtime error 32755

Hi  !
I need help with the following procedur(below).
I open a textfile, read it in to a textbox.
That works just fine. But the problem occurs when I hit cancel
button in the fileopen dialogbox.
I always get a runtime error 32755.
When I hit <F1>, I just get some error constants(no help for me).
How do I get rid of that. If I hit cancel I just want to
exit the sub, nothing more.
When I run the vb samples I also get the same error.?! What's up???
My code is below
Thanks,
 Johan

Private Sub cmdOpen_Click()
Dim sFile As String
frmMain.CMDialog1.CancelError = True
On Error GoTo OpenError
    With frmMain.CMDialog1
            .DialogTitle = "Open file..."
            .Filter = "Textfiles |*.txt|" _
                    & "All files |*.*|"
            .Flags = cdlOFNPathMustExist + cdlOFNHideReadOnly + _
                        cdlOFNFileMustExist
            .ShowOpen
    End With
    sFile = frmMain.CMDialog1.filename
ReOpen:
    If FileLen(sFile) > 65000 Then
        MsgBox "The file is too large to open.", 64
        Exit Sub
    End If
    Open sFile For Input As 1
        Do While Not EOF(1)
            frmMain.txtText.Text = Input$(LOF(1), #1)
        Loop
    Close 1
    Exit Sub

OpenError:
   If Err.Number = 55 Then
        Close 1
        GoTo ReOpen
        Exit Sub
   ElseIf Err.Number = 32755 Then
        Exit Sub
   Else
        Exit Sub
   End If
End Sub



Fri, 05 Jan 2001 03:00:00 GMT  
 I always get a runtime error 32755
Maybe this one is a bit messy, but i've been puting my error handlers
mid-code, and it seems to work pretty good, try something like

On error resume next
.
.
init for dialog
.
.
.

Dialog.showopen
If err then
    exit sub
    debug.print err.description
end if



Fri, 05 Jan 2001 03:00:00 GMT  
 I always get a runtime error 32755
Johan, this is entirely by design.
Error 32755 is "user canceled dialog", and this error is a blessing in
disguise. There are frequent times when you absolutely *must* know
whether or not the user selected something. And if you pre-filled the
filename part of the dialog, you would want to know if the user bails
out or actually *wants* to open that file.

The simplest thing to do about this is to include this line in your
error handling routine at the bottom:

If Err = 32755 then Exit sub

//Kenneth.



Quote:
>Hi  !
>I need help with the following procedur(below).
>I open a textfile, read it in to a textbox.
>That works just fine. But the problem occurs when I hit cancel
>button in the fileopen dialogbox.
>I always get a runtime error 32755.

<snip>


Sun, 07 Jan 2001 03:00:00 GMT  
 I always get a runtime error 32755
Quote:
>I need help with the following procedur(below).
>I open a textfile, read it in to a textbox.
>That works just fine. But the problem occurs when I hit cancel
>button in the fileopen dialogbox.
>I always get a runtime error 32755.
>When I hit <F1>, I just get some error constants(no help for me).
>How do I get rid of that. If I hit cancel I just want to
>exit the sub, nothing more.

>Private Sub cmdOpen_Click()
>Dim sFile As String
>frmMain.CMDialog1.CancelError = True
>On Error GoTo OpenError
>    With frmMain.CMDialog1
>            .DialogTitle = "Open file..."
>            .Filter = "Textfiles |*.txt|" _
>                    & "All files |*.*|"
>            .Flags = cdlOFNPathMustExist + cdlOFNHideReadOnly + _
>                        cdlOFNFileMustExist
>            .ShowOpen
>    End With

     If frmMain.CMDialog1.filename = "" Then Exit Sub

- Show quoted text -

Quote:
>    sFile = frmMain.CMDialog1.filename
>ReOpen:
>    If FileLen(sFile) > 65000 Then
>        MsgBox "The file is too large to open.", 64
>        Exit Sub
>    End If
>    Open sFile For Input As 1
>        Do While Not EOF(1)
>            frmMain.txtText.Text = Input$(LOF(1), #1)
>        Loop
>    Close 1
>    Exit Sub

>OpenError:
>   If Err.Number = 55 Then
>        Close 1
>        GoTo ReOpen
>        Exit Sub
>   ElseIf Err.Number = 32755 Then
>        Exit Sub
>   Else
>        Exit Sub
>   End If
>End Sub



Sun, 07 Jan 2001 03:00:00 GMT  
 I always get a runtime error 32755

try
On Error Resume Next
that just skips any code that causes an error in that sub
to disable error checking use
On Error Goto 0

Quote:

> Hi  !
> I need help with the following procedur(below).
> I open a textfile, read it in to a textbox.
> That works just fine. But the problem occurs when I hit cancel
> button in the fileopen dialogbox.
> I always get a runtime error 32755.
> When I hit <F1>, I just get some error constants(no help for me).
> How do I get rid of that. If I hit cancel I just want to
> exit the sub, nothing more.
> When I run the vb samples I also get the same error.?! What's up???
> My code is below
> Thanks,
>  Johan

> Private Sub cmdOpen_Click()
> Dim sFile As String
> frmMain.CMDialog1.CancelError = True
> On Error GoTo OpenError
>     With frmMain.CMDialog1
>             .DialogTitle = "Open file..."
>             .Filter = "Textfiles |*.txt|" _
>                     & "All files |*.*|"
>             .Flags = cdlOFNPathMustExist + cdlOFNHideReadOnly + _
>                         cdlOFNFileMustExist
>             .ShowOpen
>     End With
>     sFile = frmMain.CMDialog1.filename
> ReOpen:
>     If FileLen(sFile) > 65000 Then
>         MsgBox "The file is too large to open.", 64
>         Exit Sub
>     End If
>     Open sFile For Input As 1
>         Do While Not EOF(1)
>             frmMain.txtText.Text = Input$(LOF(1), #1)
>         Loop
>     Close 1
>     Exit Sub

> OpenError:
>    If Err.Number = 55 Then
>         Close 1
>         GoTo ReOpen
>         Exit Sub
>    ElseIf Err.Number = 32755 Then
>         Exit Sub
>    Else
>         Exit Sub
>    End If
> End Sub



Sun, 07 Jan 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. RunTime Error 32755 on W2K

2. RunTime Error 32755 on W2K

3. GetModuleHandle always getting error 126

4. Help! Getting Runtime Error 5 in this routine

5. Setup gets WRONG RUNTIME DLL error VB4

6. Scriptomatic gets runtime error at line 112

7. Help ! Getting a runtime vbscript error 800a01f4

8. Getting line numbers for runtime errors

9. Getting the Call stack during runtime or always get unhandled error info??

10. runtime always return exit code 0

11. runtime always return exit code 0

12. VB and SQL - creating a Database - errors, always errors

 

 
Powered by phpBB® Forum Software