|
-
Sep 2nd, 2006, 05:55 PM
#1
Thread Starter
Junior Member
Textbox
Hi Guy
i got a textbox contain the some value with comma(1,25,85,47,32,48)
And i want to take that value and place in their correct textbox ex
1 will go into txtbox1
25 will go into txtbox25
32 will go into txtbox32
47 will go into txtbox47
48 will go into txtbox48
and so one
How can i make a loop that does that?
Thank You
-
Sep 2nd, 2006, 06:09 PM
#2
Re: Textbox
VB Code:
Dim tmp() As String
tmp=Split([B]yourOriginalTextBox[/B].Text,",")
txtbox1.Text=tmp(0)
txtbox25.Text=tmp(1)
txtbox32.Text=tmp(2)
txtbox47.Text=tmp(3)
txtbox48.Text=tmp(4)
Rename yourOriginalTextBox with yours
-
Sep 2nd, 2006, 06:13 PM
#3
Re: Textbox
you have 99 textboxes, to cover all values?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Sep 2nd, 2006, 06:32 PM
#4
Re: Textbox
or in a loop:
VB Code:
Dim sParts() As String, N As Long
sParts = Split(yourOriginalTextBox.Text, ",")
For N = 0 To UBound(sParts)
Me.Controls("Text" & sParts(N)).Text = sParts(N)
Next N
all seems a bit pointless though - there's probably much better ways of achieving whatever it is you're trying to do.
-
Sep 2nd, 2006, 07:11 PM
#5
Thread Starter
Junior Member
Re: Textbox
Hi guy look good but one problem is there a number in the text --99 (1,25,85,47,32,48,99)
and there not a textbox to put 99 i need it to tell (msgbox) that 99 is wrong.
what i am trying to do is the the (1,25,85,47,32,48) and make sure it contain all the require number and do not consit of anyother value or any short value.
Thank You so far on what u did for me.So can you please check that out for me.
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
|