0

Okay, I am trying to extract text from a text box and redisplay it into labels. Specifically, when the user types in an address, say 123 W Elm, I want to click a button and have the "123" print in one label, the "W" to display in a second label, and finally have the "Elm" display in another. I have spent several hours playing with indexof, and substring methods, but am not quite able to do what I want....any ideas?

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by justlearnin
1
string address = "123 w elm"; //so here u would just change to address =                                         /                               //textbox1.Text
         
            string[] myArray = address.Split(' ');

            foreach (var item in myArray)
            {
                label1.Text = myArray[0];
                label2.Text = myArray[1];
                label3.Text = myArray[2];
            }

Something like the above

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.