3
Reply

How is the best way to do this?

cdog

cdog

May 24 2007 1:48 PM
1.7k
Hello I have run into an issue. I have a monster of a form I am autopopulating to from a sql database. I have 12 sections in the form that are exactly the same except a number changes on all the fields, I want to write a loop so that I can have it loop through twenty times and populate the data. this is what I have done as a test that was unsuccessful, can anyone help?

for (int a = 0; a < dataTableCOMPSALES.Rows.Count; a++)

{

DataRow rowCOMPSALES = myDataSetCOMPSALES.Tables["ComparableSale"].Rows[a];

string typeIndicator = rowCOMPSALES["SaleOrListingIndicator"].ToString();

if (typeIndicator == "S")

{

string saleListingNumber = "txtSale" + a + "ListingNumber";

+saleListingNumber+.Text = rowCOMPSALES["_ListingNumber"].ToString();

}

else

{

string listListingNumber = "txtList" + a + "ListingNumber";

}

}


Answers (3)