"rmiller" <Cu************ *@gmail.com> wrote in message
news:11******** **************@ g10g2000cwb.goo glegroups.com.. .
Thanks Ken. The issue occurs in a for loop. Got an example of how to
handle this error
Ryan
Uh oh <g> In dotNetish? Not really <g> This is converted from VB6. No
Try/Catch stuff (no "real" dotNet experience here).
The first one ignores all errors raised from accessing an invalid property..
if all you're doing is checking tab indexes, that may be all you'd need. The
second has a "trap" that shows a box if the error is anything other than the
one we're trying to trap. (there seems to be so much more typing involved in
dotNet, it's nuts)
'==========
Private Sub Command1_Click( ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArg s) Handles Command1.Click
Dim c As System.Windows. Forms.Control
Dim i As Short
On Error Resume Next
For Each c In Me.Controls
i = c.TabStop 'this is enough to raise the error
'Here you can check for Err.Number <> 0 if you want.
Next c
Err.Clear()
End Sub
Private Sub Command2_Click( ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArg s) Handles Command2.Click
Dim c As System.Windows. Forms.Control
Dim i As Short
On Error GoTo ErrorTrap
For Each c In Me.Controls
i = c.TabStop 'this is enough to raise the error
Next c
Terminate:
Exit Sub
ErrorTrap:
If Err.Number = 438 Then
Resume Next
Else
MsgBox("Error " & Err.Number)
Resume Terminate
End If
End Sub
'==========
--
Ken Halter - MS-MVP-VB (visiting from VB6 world) -
http://www.vbsight.com
Please keep all discussions in the groups..