By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,402 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,402 IT Pros & Developers. It's quick & easy.

transfer textbox text to a string arry?

P: n/a
I have asked this before, but the offered solution did not work.
I want to have a command button, that transfers any text from a textbox
to a variable which is an array. so that i can print out single letters
of the text.
e.g. if i have "hello" in the textbox and i print out the forth letter
it should list "l"....
can someone tell me howto?

Nov 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Coffee" <th**********@hotmail.com> schrieb
I have asked this before, but the offered solution did not work.
I want to have a command button, that transfers any text from a
textbox to a variable which is an array. so that i can print out
single letters of the text.
e.g. if i have "hello" in the textbox and i print out the forth
letter it should list "l"....
can someone tell me howto?


The text of the textbox is returned by it's text property. The type is
"String". A string object offers a chars property.
--
Armin

Nov 20 '05 #2

P: n/a
* Coffee <th**********@hotmail.com> scripsit:
I have asked this before, but the offered solution did not work.
I want to have a command button, that transfers any text from a
textbox to a variable which is an array. so that i can print out
single letters of the text.

e.g. if i have "hello" in the textbox and i print out the forth letter
it should list "l"....


'MsgBox(Me.TextBox1.Text.Chars(3))'.

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

P: n/a
Cor
Hi Coffee,
I have asked this before, but the offered solution did not work.
I want to have a command button, that transfers any text from a textbox
to a variable which is an array. so that i can print out single letters
of the text.
e.g. if i have "hello" in the textbox and i print out the forth letter
it should list "l"....
can someone tell me howto?


A lot of Coffee today.

In addition from the other answers. The textbox.text is a string. A string
is in itself an array of characters.

You get something out of that using VB string functions or Net string
members.

The index start at 0 so the 4th character is 3.

Using a string member it will be your example is the fouth letter
textbox1.text.substring(3,1). 4 character with a length of 1.

When you want to use a single character, use the char, do you want a part of
the string then substring.

Cor

Nov 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.