PC Review


Reply
Thread Tools Rate Thread

binding dataset to DataGridView

 
 
bill
Guest
Posts: n/a
 
      20th Dec 2006
All,

I have the following:


BindingSource bs = new BindingSource();
private void initDataGridView(DataGridView dgv)
{


// dsForDGV is a datset object on the form


dsForDGV.Tables[0].Rows.Add("abc");


bs.DataSource = dsForDGV;
bs.DataMember = dsForDGV.Tables[0].TableName;
dgv.DataSource = bs;


dgv.Refresh();
}


Nothing appears in the DataGridView. What am I missing?


TIA,


Bill

 
Reply With Quote
 
 
 
 
RobinS
Guest
Posts: n/a
 
      20th Dec 2006
Maybe you need to do an EndEdit after the Rows.Add
to update the dataset that is bound to the grid.

Robin S.
-----------------------------------------
"bill" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> All,
>
> I have the following:
>
>
> BindingSource bs = new BindingSource();
> private void initDataGridView(DataGridView dgv)
> {
>
>
> // dsForDGV is a datset object on the form
>
>
> dsForDGV.Tables[0].Rows.Add("abc");
>
>
> bs.DataSource = dsForDGV;
> bs.DataMember = dsForDGV.Tables[0].TableName;
> dgv.DataSource = bs;
>
>
> dgv.Refresh();
> }
>
>
> Nothing appears in the DataGridView. What am I missing?
>
>
> TIA,
>
>
> Bill
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagridview binding DC Microsoft C# .NET 0 1st Feb 2010 04:27 PM
Binding List<T> to a DataGridView = DataGridView Empty admlangford@gmail.com Microsoft C# .NET 3 1st Oct 2008 07:59 AM
Binding a DataGridView =?Utf-8?B?VG9tIENvc3Rhbnph?= Microsoft Dot NET Framework Forms 2 2nd Aug 2007 04:24 PM
DatagridView Binding =?Utf-8?B?Sm9obiBCdW5keQ==?= Microsoft Dot NET 3 25th Apr 2007 04:48 AM
Binding to datagridview VMI Microsoft C# .NET 2 19th Apr 2007 09:05 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:52 AM.