To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Jun 12th, 2007, 05:28 AM   #1
matrik02
Frenzied Member
 
matrik02's Avatar
 
Join Date: Feb 07
Location: Malaysia
Posts: 1,349
matrik02 is an unknown quantity at this point (<10)
Resolved [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
matrik02 is offline   Reply With Quote
Old Jun 12th, 2007, 05:33 AM   #2
leinad31
PowerPoster
 
Join Date: Nov 02
Location: Manila
Posts: 7,464
leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)
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.
leinad31 is offline   Reply With Quote
Old Jun 12th, 2007, 05:37 AM   #3
matrik02
Frenzied Member
 
matrik02's Avatar
 
Join Date: Feb 07
Location: Malaysia
Posts: 1,349
matrik02 is an unknown quantity at this point (<10)
Re: inputbox

I am still new.. Do loop?

Could you please show me the sintax how do loop work?have a sample?
matrik02 is offline   Reply With Quote
Old Jun 12th, 2007, 05:40 AM   #4
Radjesh Klauke
Fanatic Member
 
Join Date: Dec 05
Location: Sexbierum (Netherlands)
Posts: 981
Radjesh Klauke  is on a distinguished road (40+)
Re: inputbox

calll it again with: nolot
__________________


If you found my post helpful, please rate it. Codebank Submission: IE Replacement
Radjesh Klauke is offline   Reply With Quote
Old Jun 12th, 2007, 05:41 AM   #5
leinad31
PowerPoster
 
Join Date: Nov 02
Location: Manila
Posts: 7,464
leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)leinad31 is a glorious beacon of light (400+)
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
leinad31 is offline   Reply With Quote
Old Jun 12th, 2007, 10:18 AM   #6
Al42
PowerPoster
 
Join Date: Feb 06
Location: East of NYC, USA
Posts: 5,692
Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)Al42 is a jewel in the rough (300+)
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
Al42 is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:06 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.