length or trim ? how can i get textbox.text as text that publichouse to textbox.text as text that public ?

hello friends

length or trim ? how can i get textbox.text as text that publichouse to textbox.text as text that public ?

second example is ..... textbox1.text is greenhouse.. i want to get green from textbox.text

cheer


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
6/11/2008 7:06:44 AM
asp.net.web-dev-2008-express 1205 articles. 0 followers. Follow

8 Replies
1148 Views

Similar Articles

[PageSpeed] 31

Hi,

you can always perform a Trim to a retrieved string to delete the leading and trailing space characters. For your second example where you want to gt a part of the retrieved string you can use the SubString method of the String class.

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
6/11/2008 7:55:07 AM

hello

thank you for your answer:)

i have a problem again..

TextBox1.Text = TextBox2.Text.Substring(5) ' greenhouse in textbox2.text display house to textbox1.text.. but i want to display green

because i want to turn computer => to computer

computer => is listbox.item and it is one of categories

cheers


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
6/11/2008 8:09:35 AM

Hi,

you should use the overload method: TextBox2.Text.SubString(0,5) instead

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
6/11/2008 8:30:42 AM

hi

i have a problem again

i want to delete 2 character lastly

for examples

computers => should be computers

game => should be game

sub.string (0, 5) did like below

computers => compu

game => game

it is good for game but it is bad for computers :)

i can do it for per category but i have almost 2000 category so it is diffucult for me :)

i have did via below code line

Dim int As Integer

int = TextBox1.Text.Length

int = int - 2

TextBox1.Text = TextBox1.Text.Substring(0, int)

but it is 3 code lines.. is there 1 code line for this ??

cheers


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
6/11/2008 8:41:36 AM

Hi,

in that case you'll need to craft a method that can be used in a generic way that leads you to your goal by using the tools at hand like SubString, Trim, Length, ...

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
6/11/2008 8:45:20 AM

hi

below code lines work good for me :) 

Dim int As Integer

int = TextBox1.Text.Length

int = int - 2

TextBox1.Text = TextBox1.Text.Substring(0, int)

but it is 3 code lines.. is there 1 code line for this ??


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
6/11/2008 8:48:19 AM

Hi,

it would probably become something like this:

TextBox1.Text = TextBox1.Text.SubString(0,  TextBox1.Text.Length - 2)

Grz, Kris.


Read my blog. Handy Firefox plugins for web developers.


Workaround for non working Mark as answer buttons.
0
XIII
6/11/2008 8:55:44 AM

hi

thank you for your all advice :)

your lastly code line is so good for me

cheers


Mark as me if my question or my answer can be helpful for you :)
0
oguzkaygun
6/11/2008 9:40:33 AM
Reply: