how to remove last row

smriti

Regular
Joined
Jan 7, 2005
Messages
54
hi all,

i am using access database and when i load the grid
the last blank row is also appearing.
how to make it invisible.


Thanks.
 
If the grid can be made read only, do so:

myGrid.ReadOnly = True.

Otherwise, you need to set up a DataView:

(from memory):

Dim dv as New DataView(YourDataTable_or_YourDataSet)
dv.AddNew = False
MyGrid.Datasource = dv


B.
 
Thanks for your reply.
But i am getting an exception
cannot create a child list for field Table2

I used the following

string strSql=@"Select * from Table2";
da=new OleDbDataAdapter(strSql,constr);
ds.Clear();
da.Fill(ds,"Table2");
DataView dv=new DataView(ds.Tables["Table2"]);
dv.AllowNew=false;
this.dataGrid1.DataSource=dv;
this.dataGrid1.SetDataBinding(dv,"Table2");

Thanks
 
Try the following (VB Code)

Dim cm As CurrencyManager = BindingContext(dataGrid1.DataSource, dataGrid1.DataMember)
Dim dv As DataView = cm.List
dv.AllowNew = False
 
Back
Top