I am creating a website and wish to make a 'flashcard' page which shows interesting facts about the topic the site is based on (music).
I have created an arraylist and added some 'facts' to it as a string value.
I have a textbox on my page and I have a button and I want to show a different fact each time the button is clicked to the textbox.
What would be the best way to go about it?
Sorry I am a newbie here and am just getting to grips with ASP.NET and VS.
EDIT
Thanks, I have now changed it to list. Now I have stored multiple string values to that list and have set a string field called 'abc' (like so);
public partial class _Default : System.Web.UI.Page
{
private String abc;
public void do9()
{
List<String> list = new List<String>();
list.Add("aaa");
list.Add("bbb");
list.Add("ccc");
list.Add("ddd");
list.Add("eee");
foreach (String prime in list) // Loop through List with foreach
{
abc = prime;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
do9();
TextBox1.Text = abc;
}
}
Now how can I return a different list value upon the buttonclicked event? Currently it only returns 'eee'. Say I want it to return "aaa" etc instead when the button is clicked each time.
Thanks again!