7
Answers

Use string array as identifier

Ijoran

Ijoran

16y
3.9k
1

I want to use a string array as an identifier to interact with a group of textboxes in a userform.

this would mean having code like

string[] Book = new string[5];

Book[1] = "Title"; Book[2] = "Author"; ...etc

Then I could use this to obtain information from the textbox.  e.g. MessageBox.Show (Userform.Book[1].Text.toString());

 

I don't seem to be able to find a way to convert/cast the string so I can use it to identify the TextBox in the Userform so would it be right to assume it is not possible?

Answers (7)
0
Ish Bandhu

Ish Bandhu

NA 1.5k 272.4k 12y
put your code in page load event with

if(!IsPostBack)
{
<pre>int i = 3;
            DataTable dt = ibl2.combo1(i);
            countrycombo.DataSource = dt;
             countrycombo.DataBind();
            countrycombo.DisplayMember =Convert.ToString( dt.Columns["Country_name"]);
            countrycombo.ValueMember = Convert.ToString(dt.Columns["Country_id"]);</pre>

}