how do i add the textbox with automatic identify the sql data type when key in the data to textbox?TQ, because the code i do is, when the gridcontrol(devexpress component) is fill with data, panel5 will fill up the loop of textbox follow by the quantity of sql columns.
private void filltexttotextbox(DataTable DataT)
{
DevExpress.XtraEditors.TextEdit NTB;
int y = 12;
if (DataT != null)
{
foreach (DataColumn DC in DataT.Columns)
{
NTB = DevTE(10, y);
NTB.DataBindings.Add(new Binding("Text", DataT, DC.ColumnName));
panel5.Controls.Add(NTB);
y += 23;
}
}
else
{
return;
}
}
private DevExpress.XtraEditors.TextEdit DevTE(int X, int Y)
{
DevExpress.XtraEditors.TextEdit TE = new DevExpress.XtraEditors.TextEdit()
{
Text = null,
Location = new Point(X, Y),
Size = new Size(150, 50),
};
return TE;
}
private void loaddata()
{
gridControl1.DataSource = DT3;
gridView1.OptionsBehavior.Editable = false;
filltexttotextbox((DataTable)gridControl1.DataSource);
}
What I have tried:
i have try to using datatable to add, but also not working, because the code that i want to do is, when the textbox key in value that no same with the sql data it will show a messagebox to notifier the value is no same with the data type.