|
-
March 3rd, 2010, 06:15 PM
#1
How to directly move from msgbox to form1
Hi, i am having a problem on my program
Private Sub Command1_Click()
If text1.Text = "" Then
MsgBox ("You have no content on your 1st Textbox")
Else
End If
.
.
.
Bunch of codes that will result to an error if there is no value for text1.text
When the user clicks the command button and the textbox is blank, there will be a msgbox popping out.
But how can i make the program go back to the form1 without continuing the program since there would be errors after the first if statement
-
March 3rd, 2010, 06:59 PM
#2
Re: How to directly move from msgbox to form1
Ever push F1 for Help? If you went to the word SUB and did it, you'd see the syntax of the command. (works for all of them!)
Code:
Else
Exit Sub
End If
-
March 3rd, 2010, 07:24 PM
#3
Re: How to directly move from msgbox to form1
 Originally Posted by dglienna
Ever push F1 for Help? If you went to the word SUB and did it, you'd see the syntax of the command. (works for all of them!)
Code:
Else
Exit Sub
End If
oh, i just used the portable version of vb 6.0 and there's no help on it.. really sorry,
uhm about the code it still has an error, so far this is what i got sir
Code:
Private Sub Command1_Click()
If text1.Text = "" Then
MsgBox ("You have no content on your 1st Transformation Matrix")
Else
Exit Sub
End If
'this is the next code after End If
text2.text= text1.text + 1
It says Run-time error '9':
Type mismatch
Last edited by lloydi12345; March 3rd, 2010 at 07:30 PM.
-
March 4th, 2010, 02:23 AM
#4
Re: How to directly move from msgbox to form1
Code:
Private Sub Command1_Click()
If text1.Text = "" Then
MsgBox ("You have no content on your 1st Transformation Matrix")
Exit Sub '<-- Required here
Else
'Exit Sub <--- Not required, here you can write your execution code
End If
'this is the next code after End If
text2.text= text1.text + 1 '<--- Here you may end up with wrong results
'If you are performing mathematical operation and if the value in textbox is non numeric??
'my advice is write a different Sub or function to validate the text in textbox before manipulating
Encourage the efforts of fellow members by rating
Lets not Spoon Feed and create pool of lazy programmers
- ComIT Solutions
-
March 4th, 2010, 02:46 AM
#5
Re: How to directly move from msgbox to form1
Make sure you can't put A in the box, or 1,234.00
-
March 4th, 2010, 05:35 PM
#6
Re: How to directly move from msgbox to form1
very good sir! now im done thanks really
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|