Many Access Violation
Posted: Sat Jul 23, 2011 9:35 pm
I got many errors With this code: Access Violation & Runtime Error.
Run it and put some characters in the fields and click on check
(I used `goto Label` to exit from SUB, because EXIT SUB don`t seems to work)
----------------------------------------------------------------
Object Mainform as form
Caption = "Form"
Width = 200
Height = 300
Center
Object Edit_1 as edit
Top = 40
Left = 20
Width = 100
End Object
Object Edit_2 as Edit
Top = 80
Left = 20
Width = 100
End Object
Object Edit_3 as Edit
Top = 120
Left = 20
Width = 100
End Object
Object Edit_4 as Edit
Top = 160
Left = 20
Width = 100
End Object
Object CheckButton as Button
Top = 200
Left = 30
Caption = "Check"
OnClick = CheckEmptyFields
END Object
ShowModal
End Object
`--------------------------------------------------------
SUB CheckEmptyFields
IF Edit_1.Text = "" THEN
ShowMessage "Empty Field #1"
GOTO ExitFromThisSub
END IF
IF Edit_2.Text = "" THEN
ShowMessage "Empty Field #2"
GOTO ExitFromThisSub
END IF
IF Edit_3.Text = "" THEN
ShowMessage "Empty Field #3"
GOTO ExitFromThisSub
END IF
IF Edit_4.Text = "" THEN
ShowMessage "Empty Field #"
END IF
ExitFromThisSub:
END SUB
Run it and put some characters in the fields and click on check
(I used `goto Label` to exit from SUB, because EXIT SUB don`t seems to work)
----------------------------------------------------------------
Object Mainform as form
Caption = "Form"
Width = 200
Height = 300
Center
Object Edit_1 as edit
Top = 40
Left = 20
Width = 100
End Object
Object Edit_2 as Edit
Top = 80
Left = 20
Width = 100
End Object
Object Edit_3 as Edit
Top = 120
Left = 20
Width = 100
End Object
Object Edit_4 as Edit
Top = 160
Left = 20
Width = 100
End Object
Object CheckButton as Button
Top = 200
Left = 30
Caption = "Check"
OnClick = CheckEmptyFields
END Object
ShowModal
End Object
`--------------------------------------------------------
SUB CheckEmptyFields
IF Edit_1.Text = "" THEN
ShowMessage "Empty Field #1"
GOTO ExitFromThisSub
END IF
IF Edit_2.Text = "" THEN
ShowMessage "Empty Field #2"
GOTO ExitFromThisSub
END IF
IF Edit_3.Text = "" THEN
ShowMessage "Empty Field #3"
GOTO ExitFromThisSub
END IF
IF Edit_4.Text = "" THEN
ShowMessage "Empty Field #"
END IF
ExitFromThisSub:
END SUB