I made WinForm application with DevExpress, and it's a part of my code(C#):
public partial class XtraForm1 : DevExpress.XtraEditors.XtraForm
{
private DataTable _Tbl;
private DataTable CreateTable(int RowCount)
{
_Tbl = new DataTable();
_Tbl.Columns.Add("New Field", typeof(string));
for (int i = 0; i < RowCount; i++)
_Tbl.Rows.Add(new object[] { });
return _Tbl;
}
int i = 0;
private void simpleButton1_Click_1(object sender, EventArgs e)
{
i++;
int index = i % _Tbl.Columns.Count;
DevExpress.XtraGrid.Columns.GridColumn col = gridView1.Columns.AddVisible(_Tbl.Columns[index].ColumnName);
col.Name = "Column_{0}" + i;
}
public XtraForm1()
{
InitializeComponent();
gridControl1.DataSource = CreateTable(20);
gridView1.Columns.Clear();
}
}
the code will make a column at run-time when the button pressed, my question is How can I bind the selected column at XtraGrid with the data from any DBMS with the selected column from selected table in database selected at run-time
sorry for my bad English. I hope all of you can help me. Thanks