|
-
May 9th, 2001, 12:22 PM
#1
Thread Starter
New Member
Passing the value,from a inptbx in a sbfunctn
I have an inputbox that has to come up several times, I have decided to call out this Inputbox with a subfunction(due to being used 4 or more times).
Here is the prob:
The value of the inputbox is not being passed on.
I have ran through the prgrm in step mode several time and can't quite figure out why!!
Any sugeestions
-
May 9th, 2001, 12:26 PM
#2
PowerPoster
Code:
strResponse = InputBox("Please enter a number")
Now, you realize strResponse's life is only as long as the procedure is executing. If you need to persist it for the life of the project, either declare it as a form module varialble or public variable in a (.bas) module.
-
May 9th, 2001, 12:41 PM
#3
Fanatic Member
Not really sure why you need to create a function to call the InputBox Function.
Doing something like this
Code:
Private Sub Command1_Click()
Text1.Text = getInputBox()
End Sub
Private Sub Command2_Click()
Text2.Text = getInputBox()
End Sub
Private Function getInputBox()
getInputBox = InputBox("Enter Data to place in text box", "Please Enter Data", "New Text")
End Function
Can be done with
Code:
Private Sub Command1_Click()
Text1.Text = InputBox("Enter Data to place in text box", "Please Enter Data", "New Text")
End Sub
Private Sub Command2_Click()
Text2.Text = InputBox("Enter Data to place in text box", "Please Enter Data", "New Text")
End Sub
Perhaps if you post your code, you could get additional help.
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
|