how to get data from datatable and repeate it according to number of rows

  • Thread starter Thread starter ahmedabosalah
  • Start date Start date
A

ahmedabosalah

Guest
Problem

how to get data from data table and repeat it according to number of rows ?

my datatable as following

public DataTable GetChecked()
{
DataTable table = new DataTable();
table.Columns.Add("MemberCode", typeof(string));
table.Columns.Add("MemberImage", typeof(Byte[]));

for (int i = 0; i < dtDisplayDataPayment.Rows.Count; i++)
{

bool Ischecked = Convert.ToBoolean(GridFooter.Rows.Cells["PrintFlag"].Value);
if (Ischecked == true)
{
DataRow newRow = table.NewRow();
newRow["MemberCode"] = Utilities.ObjectConverter.ConvertToString(dtDisplayDataPayment.Rows["MemberCode"]);



if (dtDisplayDataPayment.Rows["MemberImage"] != System.DBNull.Value)
{
byte[] photo_aray = (byte[])dtDisplayDataPayment.Rows["MemberImage"];
System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
Image img = (Image)converter.ConvertFrom(photo_aray);
newRow["MemberImage"] = imageToByteArray(img);



}
table.Rows.Add(newRow);
}
}

return table;


}

what i need is to generate label for MemberCode on form and repeted based on number of records .

Suppose datatable have 4 records from MemberCode 1001 to 1004 then it will be as below

window form showdata

MemberCode : 1001 Membercode : 1002

MemberCode :1003 Membercode : 1004

so that how to make design above by csharp windows form visual studio 2015 ?

Continue reading...
 
Back
Top