Author |
Message |
Anya
|
Posted: Sat Jun 17, 2006 6:24 pm Post subject: What am i doing Wrong?? |
|
|
The following is the code I have for error checking within my subprogram,
If txtName.Text = "" Then MsgBox "Name not Entered", vbOkOnly, "DAte Input Error"
ElseIf Not IsNumeric (txtSilver.Text) Then MsgBox "Not a Number",
vbOkOnly, "Data Input Error"
my problem here is when I run the program im given an error message that says Else without If. and then directs me to the ElseIf statement. I dont know whats wrong, can anyone help ????  |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
wtd
|
Posted: Sat Jun 17, 2006 6:50 pm Post subject: (No subject) |
|
|
Use code tags, and skip to a newline after "then". |
|
|
|
|
 |
Anya
|
Posted: Sat Jun 17, 2006 6:54 pm Post subject: (No subject) |
|
|
i do have a new line after then in my actual program... and what do you mean by code tags, i thought i was |
|
|
|
|
 |
wtd
|
Posted: Sat Jun 17, 2006 7:01 pm Post subject: (No subject) |
|
|
|
|
|
|
|
 |
GlobeTrotter
|
Posted: Sat Jun 17, 2006 8:27 pm Post subject: (No subject) |
|
|
Also, it is proper formatting to use parenthesis when calling a function. eg: instead of
use
code: |
Call MsgBox ("Hello")
|
|
|
|
|
|
 |
Anya
|
Posted: Sat Jun 17, 2006 8:46 pm Post subject: (No subject) |
|
|
I know that but they arent necessary for it to work.. i just want it to work... i still keep getting and erroe message that saya Else without If.. and sends me back to the ElseIf ... i cant see the problem |
|
|
|
|
 |
GlobeTrotter
|
Posted: Sat Jun 17, 2006 9:18 pm Post subject: (No subject) |
|
|
This should work, if not post the exact code causing the problems.
code: |
If txtName.Text = "" Then
Call MsgBox ("Name not Entered", vbOkOnly, "Data Input Error")
ElseIf Not IsNumeric (txtSilver.Text) Then
Call MsgBox ("Not a Number", vbOkOnly, "Data Input Error")
End If
|
|
|
|
|
|
 |
cool dude

|
Posted: Sun Jun 18, 2006 10:38 am Post subject: (No subject) |
|
|
Anya wrote: i do have a new line after then in my actual program... and what do you mean by code tags, i thought i was
thats a lie! the reason i know is because that is the exact error your getting because your not skipping a line. btw u r missing an end if at the end of your code. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
|