Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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

  • 2 months later...
Posted

Try the following (VB Code)

 

Dim cm As CurrencyManager = BindingContext(dataGrid1.DataSource, dataGrid1.DataMember)

Dim dv As DataView = cm.List

dv.AllowNew = False

Hamlet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...