Array question. Coding help required

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Was wondering if someone could please help me with an array I'd like to
create in an asp.net page. I have to design an array which stores the values
of addresses manually entered into textboxes (txtAdd,txtCity&txtPostcode).
The array must hold the values of these three textboxes. I would like the
array to also display these address values in an asp:Lable within a
asp:TableCell inside a asp:Table.

I want all this to happen on the onclick event of a button. So basically
store the textbox values into an array and then populate there contents in a
asp:Table. I need the array to loop around as many times required until the
user stops entering values.

I am very new to coding and have never designed an array like this before so
Im finding it difficult to do. Could someone please help me with the code to
achieve this. Thanks in advance for any help anyone can give me
 
Declaring an array that contains the text values of 3 textboxes (tb1, tb2,
tb3):

string [] values = new string[] { tb1.Text, tb2.Text, tb3.Text };

As to getting the text into a label, you can do something like:

myLabel.Text = string.Format("{0}\n{1}\n{2}", values[0], values[1],
values[2]);

Please excuse any minor syntax errors, as this hasn't been compiled and it's
immediately after lunch ;)
 
Back
Top