|
-
Jun 29th, 2000, 01:29 PM
#1
Thread Starter
Fanatic Member
I hope I can make this make sense....
I have two buttons named cmdButtonOne and cmdButtonTwo and two text fields named txtOne and txtTwo, and one text field named txtInput.
what I want is the user inputs text into txtInput and when they click one of the buttons it puts the text into the apropriate txtfield(txtOne or txtTwo depending on what button they click)
here is the code I have at the moment(I have tried everything possible tonight)
Private Sub cmdOne_Click()
Static strInput As String
'set property of txtOne to strMain
strInput = txtMain.Text
If strInput = "" Then
txtOne.Text = txtInput.Text
Else
txtOne.Text = strInput
End If
'clear txtInput
txtInput.Text = ""
End Sub
I tried to dim the strInput in (general)but I couldn't get it to work...I can get this to work by not using the dim or static variable it is not as efficiant.
I hope this made sense.
Thanks to anyone who helps out.
Pnj
-
Jun 29th, 2000, 01:37 PM
#2
Fanatic Member
How about:
Code:
Private Sub cmdButtonOne_Click()
txtOne.Text=txtInput.Text
End Sub
Private Sub cmdButtonTwo_Click()
txtTwo.Text=txtInput.Text
end Sub
That would put the txtInput into appropriate textbox (textone or texttwo) depending on what button the user pressed
-
Jun 30th, 2000, 08:44 AM
#3
Just a note. Because the Text of a TextBox is the default property, you can omit the .Text when you are working with it.
-
Jun 30th, 2000, 10:49 AM
#4
Thread Starter
Fanatic Member
Thanks..but......uh.......:)
Thanks Megatron and QWERTY, but I was trying to create a variable and check the txtinput box then use the variable if txtInput was empty.
I figured it out though.
by the way I got this to work (the actuall project has four buttons and 5 text boxs. the idea is text is only in one box at a time and moves to what ever button the user clicks on)
but the code I use was WAY to long somthing like
if txtOne="" AND txtTwo ="" and ect....
checking all the boxes. I had five If then else statments for each button.
anyways.............
thanks for the response.I'm sure I'll be back with more questions.
pnj
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
|