DataTable table = new DataTable();
table.Columns.Add(new DataColumn( "Text", typeof( string ) ) );
table.Columns.Add(new DataColumn( "Number", typeof( double ) ) );
table.Rows.Add( new object[] { "Value 1", 1 } );
table.Rows.Add( new object[] { "Value 2", 2 } );
table.Rows.Add( new object[] { "Value 3", 3 } );
dataGridView1.DataSource = table;
Output: Microsoft AX 2012, X++, C#, SQL server, SSRS, Java, JavaFX, Oracle, PL/SQL, Delphi - codes examples, step-by-step tutorials, experiences.
Showing posts with label c# - DataTable. Show all posts
Showing posts with label c# - DataTable. Show all posts
Tuesday, September 11, 2018
C# - How add values to DataGridView (with source in DataTable)
Tuesday, September 4, 2018
C# - How to add items to ListBox from DataTable
DataTable table = new DataTable();
table.Columns.Add( new DataColumn( "Text", typeof( string ) ) );
table.Columns.Add( new DataColumn( "Number", typeof( double ) ) );
table.Rows.Add( new object[] { "Value 1", 1 } );
table.Rows.Add( new object[] { "Value 2", 2 } );
table.Rows.Add( new object[] { "Value 3", 3 } );
listBox1.DisplayMember = "Text";
listBox1.DataSource = table;
Output:
Subscribe to:
Posts (Atom)

