R
Rich
I am migrating from VB.net to C# (after about 8 years with VB.Net)
Here is how I managed to bind a datasource to my datagridview in C#, and
below that is how I do it in VB.Net. Question is if I can change the C# code
here to be a little less verbose like the VB.net sample?
//C#
BindingSource bs = new BindingSource();
bs.DataSource = ds; //ds is a dataset
bs.DataMember = ds.Tables[0].TableName;
//bs.DataMember = ds.Tables("tbl1"); <--vb.net style - is there a way to use
//tablename directly instead of ds.Tables.Tablename ?
dgrv1.DataSource = bs;
dgrv1.Refresh();
'--VB.net
dgrv1.DataSource = ds.Tables("tbl1")
Here is how I managed to bind a datasource to my datagridview in C#, and
below that is how I do it in VB.Net. Question is if I can change the C# code
here to be a little less verbose like the VB.net sample?
//C#
BindingSource bs = new BindingSource();
bs.DataSource = ds; //ds is a dataset
bs.DataMember = ds.Tables[0].TableName;
//bs.DataMember = ds.Tables("tbl1"); <--vb.net style - is there a way to use
//tablename directly instead of ds.Tables.Tablename ?
dgrv1.DataSource = bs;
dgrv1.Refresh();
'--VB.net
dgrv1.DataSource = ds.Tables("tbl1")