c# 4.0 - How to call an item from a list of items in c# -


i got list this, method isn't working, appreciated.

//my list of values  list<string> values = new list { "$100","$300","$500"}; 

in button1_click method

int = 2;  object o = values[i];//i want have value 2  this.button1.text = convert.tostring(i); //i want button text out value values[i].  

you're converting wrong item.

this.button1.text = convert.tostring(i); //<---- should o 

change to:

this.button1.text = convert.tostring(o); 

but shouldn't converting string object , string.

could use:

this.button1.text = values[i]; 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo