ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278.4k

How to generate labels from datatable based on records exist

Feb 2 2019 7:04 PM
Problem
 
how to get data from data table and repeat it according to number of rows ?
 
my datatable name is GetChecked
 
What i need is to generate label for MemberCode 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 ?
 
code 
  1. public DataTable GetChecked()  
  2. {  
  3.     DataTable table = new DataTable();  
  4.     table.Columns.Add("MemberCode"typeof(string));  
  5.     for (int i = 0; i < dtDisplayDataPayment.Rows.Count; i++)  
  6.     {
  7.         DataRow newRow = table.NewRow();  
  8.         newRow["MemberCode"] = Utilities.ObjectConverter.ConvertToString(dtDisplayDataPayment.Rows[i]["MemberCode"]);     
  9.         table.Rows.Add(newRow);  
  10.     }
  11.     return table;
  12. }

Answers (2)