Hiya Arsalan,

Actually that did seem to do the trick...  I also had to set
dgvCustomer.AutogenerateColumns=False but with this plus using
DataMember as well as DataSource plus not setting Datasource to
nothing is working quite well.

Thanks --

Alex


On Aug 24, 11:09 pm, sallushan <[EMAIL PROTECTED]> wrote:
> I think this is because you have bind the DataGridView control
> directly to the Table. Instead you should as,
>
> dgvCustomer.DataSource = .CustomerDS
> dgvCustomer.DataMember = .CustomerDS.Tables(0).TableName ' or
> "customer" <- table name
>
> Also try NOT to change the DataSource/DataMember property of DGV, just
> refresh your DataSet (CustomerDS), the DataGridView then automatically
> will refresh itself.
>
> Regards,
> Arsalan Tamiz
>
> On Aug 25, 2:14 am, Alex <[EMAIL PROTECTED]> wrote:
>
> > Hi Everyone,
>
> > I have a very strange DataGridView question.  In VB, I've setup a
> > DataGridView with Visual Studio 2005 as I want it with the following
> > two columns:
> > HeaderText: Customer ID
> > Name: dgvCustomerID
> > DataPropertyName: CustomerID
>
> > HeaderText: Customer Name
> > Name: dgvCustomerName
> > DataPropertyName: CustomerName
>
> > And I'm using the following to populate it from a DataSet which only
> > has two columns, CustomerID and CustomerName:
> > dgvCustomer.DataSource = Nothing
> > dgvCustomer.AutoGenerateColumns = False
> >   With .CustomerDS
> >     If .Tables(0).Rows.Count > 0 Then
> >       dgvCustomer.DataSource = .Tables(0)
> >     End If
> >   End With
>
> > The first time I run through the formatting looks okay, but I have
> > code set to reload the page which reruns the code above and at that
> > point all my formatting is changed.  It's like it's a blank
> > datagridview and it's just dropping the data from the dataset it with
> > on formatting.  I even stepped through it, and the
> > dgvCustomer.columns(0).Name is dgvCustomerID when I first run it but
> > then just CustomerID after the refresh.
>
> > Any ideas on how to fix this?  Oh, and this is in a Winform app
> > running on VB 2005.
>
> > Thanks --
>
> > Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to