T
tshad
I have some code that is exactly the same except for 1 name.
In the "for loops" below the 2nd parameters change as they are pointing to
separate string arrays in the structure:
nhDataBean.benefitGroupCodeList.GetUpperBound(0)
nhDataBean.jobCodeList.GetUpperBound(0)
***************************************************************
public DataTable GetBenefits()
{
int ktr1 = 0;
DataTable dt = new DataTable();
DataRow dr;
// Add the columns to the DataTable's Columns collection
dt.Columns.Add("code");
dt.Columns.Add("description");
for (ktr1=1;ktr1<=nhDataBean.benefitGroupCodeList.GetUpperBound(0);ktr1++)
{
dr = dt.NewRow();
dr["code"] = nhDataBean.benefitGroupCodeList[ktr1][0];
dr["description"] = nhDataBean.benefitGroupCodeList[ktr1][1];
dt.Rows.Add(dr);
}
return dt;
}
public DataTable GetJobTitles()
{
int ktr1 = 0;
DataTable dt = new DataTable();
DataRow dr;
// Add the columns to the DataTable's Columns collection
dt.Columns.Add("code");
dt.Columns.Add("description");
for (ktr1=0;ktr1<=nhDataBean.jobCodeList.GetUpperBound(0);ktr1++)
{
dr = dt.NewRow();
dr["code"] = nhDataBean.jobCodeList[ktr1][0];
dr["description"] = nhDataBean.jobCodeList[ktr1][1];
dt.Rows.Add(dr);
}
return dt;
}
**********************************************************************
There are about 10 of these in the structure.
Is there a way to pass this into one function change the for loop to use the
variable passed in?
Thanks,
Tom
In the "for loops" below the 2nd parameters change as they are pointing to
separate string arrays in the structure:
nhDataBean.benefitGroupCodeList.GetUpperBound(0)
nhDataBean.jobCodeList.GetUpperBound(0)
***************************************************************
public DataTable GetBenefits()
{
int ktr1 = 0;
DataTable dt = new DataTable();
DataRow dr;
// Add the columns to the DataTable's Columns collection
dt.Columns.Add("code");
dt.Columns.Add("description");
for (ktr1=1;ktr1<=nhDataBean.benefitGroupCodeList.GetUpperBound(0);ktr1++)
{
dr = dt.NewRow();
dr["code"] = nhDataBean.benefitGroupCodeList[ktr1][0];
dr["description"] = nhDataBean.benefitGroupCodeList[ktr1][1];
dt.Rows.Add(dr);
}
return dt;
}
public DataTable GetJobTitles()
{
int ktr1 = 0;
DataTable dt = new DataTable();
DataRow dr;
// Add the columns to the DataTable's Columns collection
dt.Columns.Add("code");
dt.Columns.Add("description");
for (ktr1=0;ktr1<=nhDataBean.jobCodeList.GetUpperBound(0);ktr1++)
{
dr = dt.NewRow();
dr["code"] = nhDataBean.jobCodeList[ktr1][0];
dr["description"] = nhDataBean.jobCodeList[ktr1][1];
dt.Rows.Add(dr);
}
return dt;
}
**********************************************************************
There are about 10 of these in the structure.
Is there a way to pass this into one function change the for loop to use the
variable passed in?
Thanks,
Tom