Click here to Skip to main content
15,924,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
is that like this?list.add(new string[]{textbox.Text});

What I have tried:

list.add(new string[]{textbox.Text});
Posted
Updated 22-Feb-16 0:23am

well, apart from the issue of not knowing exactly what you want, since your question title uses 'array', yet your code uses 'list', I'll assume 'list' for now - how about

someList.add(someTextBox.Text);

?

(this assumes you have declared someList and SomeTextBox is a valid TextBox on your form)
 
Share this answer
 
Assuming that you want to add some value to a list of string or int, check this:
C#
List<int> intList = new List<int>
intList.Add(1);
intList.Add(100);

List<string> stringList = new List<string>
stringList.Add("new string");
stringList.Add("other string");


For further information, please see: List(T) Class (System.Collections.Generic)[^]
 
Share this answer
 
thank you for answer my question.i am sorry i was wrong to deklare my problem.i mean Does c# can do if i adding string from textbox then the string will be write in a code.

example:
C#
mylist.Add(new string[] {""});



when i type "banana" from textbox and i clik save it will add or update automaticly from the code.
it become like this.

C#
mylist.Add(new string[] {"banana"});



thank you somuch.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900