Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strange Behavior Of DataGridView
Message
De
14/05/2007 17:28:19
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01225269
Message ID:
01225387
Vues:
18
How are you unbinding and rebinding the DataSource? I'm not real experienced with the DGV, but I'll try to help you figure it out anyway! =0) (Or someone else may have an idea)

~~Bonnie




>I am using a DGV Object, which I initially bind its DataSource to a DataTable. After binding, I run a "FormatGrid()" method which format the columns of the grid. One command I do is the following:
>
>
>        If gridStudents.Columns.Contains("DOB") Then
>            With gridStudents
>                .Columns("DOB").HeaderText = "DOB"
>                .Columns("DOB").Width = objGraphics.MeasureString("XX/XX/XXXX", objFont).Width + 15
>                .Columns("DOB").DisplayIndex = 3
>                .Columns("DOB").CellTemplate.Style.Format = "MM/dd/yyyy"
>            End With
>        End If
>
>
>Now, the above code works perfectly...the first time. But later, if I reload the data in the DataTable, which I then unbind and rebind the DataSource and call the FormatGrid() method again, the "MM/dd/yyyy" format will not apply itself. It defaults to the mormal date display.
>
>Anyone know what I am doing wrong or how to force the DGV to display the Date format as I want it to?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform