I have a need to build some search criteria using the inputs user entered.
string searchText1 = "";
string searchText2 = "";
string searchText3 = "";
searchText1 = scCB1.Text + op1.Text + cr1.Text;
searchText2 = scCB2.Text + op2.Text + cr2.Text;
searchText3 = scCB3.Text + op3.Text + cr3.Text;
where scCB1, op1, cr1, ... are the combobox and text fields on GUI.
Is there a way I could use a loop to replace the hard coded statements (they look awkward)?
For (i = 0; i < 3; i++)
{
// searchText(i) = scCB(i).Text + op(i).Text +cr(i).Text)
}
As a rookie in programming, I understand if I display and build only one set of fields on GUI, then I'll be able to loop in the code. But I am curious how i could address the name of the objects dynamically. Thanks in advance for all your help!