|
-
Jun 12th, 2007, 05:28 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] inputbox
How I can promote the inputbox again when the user did not input the value in the inputbox?
Code:
nolot = InputBox("Sila Masukkan No Lot", "Carian No Lot")
If Len(nolot) = 0 Then
MsgBox "Please input no lot"
Else
MsgBox "tahniah"
End If
End Sub
-
Jun 12th, 2007, 05:33 AM
#2
Re: inputbox
You could do so with a Do Loop which checks nolot but then the user will be locked in an infinite loop until he enters valid data. It would be better to create your own input form which allows the user to select Cancel which you will then process accordingly.
-
Jun 12th, 2007, 05:37 AM
#3
Thread Starter
Frenzied Member
Re: inputbox
I am still new.. Do loop?
Could you please show me the sintax how do loop work?have a sample?
-
Jun 12th, 2007, 05:40 AM
#4
Re: inputbox
calll it again with: nolot
-
Jun 12th, 2007, 05:41 AM
#5
Re: inputbox
Code:
Do
nolot = InputBox("Sila Masukkan No Lot", "Carian No Lot")
If Len(nolot) = 0 Then MsgBox "Please input no lot"
Loop Until Len(nolot) > 0
-
Jun 12th, 2007, 10:18 AM
#6
Re: [RESOLVED] inputbox
Add a form to the project.
Put a label, a textbox and two command buttons on the form. Make the caption of one button "OK" and the other one "Cancel". In a module put:
Public bCancel As Boolean
Public sInput As String
In your program, set the form's caption to "Carian No Lot" (frmMain.Caption = "Carian No Lot") , its label to "Sila Masukkan No Lot" (frmMain.Label1.Caption = "Sila Masukkan No Lot"), set bCancel to False and show the form modal (frmInput.Show vbModal).
In the input form's code, if the user clicks the cancel button, set bCancel to True. If he clicks the OK button, set sInput to what's in the textbox.
If either button is clicked, unload the form (Unload Me).
Back in your main program, if bCancel is True, the user wants to cancel, otherwise his answer is in sInput.
You can make the form look like a standard InputBox or anything else you prefer.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
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
|