|
|
#1 |
|
Frenzied Member
Join Date: Feb 07
Location: Malaysia
Posts: 1,349
![]() |
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
|
|
|
|
|
|
#2 |
|
PowerPoster
Join Date: Nov 02
Location: Manila
Posts: 7,464
![]() ![]() ![]() ![]() ![]() ![]() |
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.
__________________
Roman Numerals, Number In Words,Indian Currency Format, Modified Insertion Sort, Fibonacci |
|
|
|
|
|
#3 |
|
Frenzied Member
Join Date: Feb 07
Location: Malaysia
Posts: 1,349
![]() |
Re: inputbox
I am still new.. Do loop?
Could you please show me the sintax how do loop work?have a sample? |
|
|
|
|
|
#4 |
|
Fanatic Member
Join Date: Dec 05
Location: Sexbierum (Netherlands)
Posts: 981
![]() |
Re: inputbox
calll it again with: nolot
__________________
![]() If you found my post helpful, please rate it. Codebank Submission: IE Replacement |
|
|
|
|
|
#5 |
|
PowerPoster
Join Date: Nov 02
Location: Manila
Posts: 7,464
![]() ![]() ![]() ![]() ![]() ![]() |
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
__________________
Roman Numerals, Number In Words,Indian Currency Format, Modified Insertion Sort, Fibonacci |
|
|
|
|
|
#6 |
|
PowerPoster
Join Date: Feb 06
Location: East of NYC, USA
Posts: 5,692
![]() ![]() ![]() ![]() |
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 |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|