cs_Creat
Messages postés76Date d'inscriptiondimanche 25 juillet 2004StatutMembreDernière intervention20 mars 2006
-
18 oct. 2004 à 12:10
cs_Creat
Messages postés76Date d'inscriptiondimanche 25 juillet 2004StatutMembreDernière intervention20 mars 2006
-
19 oct. 2004 à 05:18
Je ne comprend pas ce qui ce passe. Avec le DataGrid tout est correct, mais le ListeView je voie juste la premiere ligne comme il le faut. Les autres lignes il m'affiche seulement la date. Voici une partie de mon code:
Private Sub mdiListeDateCours_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim ds As New DataSet ' Dans note cas ca va etre DBDataSet
Dim DBDataAdapter As OleDb.OleDbDataAdapter
Dim DBDataTable As DataTable
Dim DBDataRow As DataRow
Dim SQLString As String
Dim Table As String = "T_Date"
SQLString = "Select DateCours, nbPersonne, GroupeID from T_Date"
DBDataAdapter = New OleDb.OleDbDataAdapter(SQLString, DBConnection)
DBDataAdapter.Fill(DBDataSet)
lvDate.Items.Clear()
'Repeat for each table in the DataSet collection.
For Each DBDataTable In DBDataSet.Tables
'Repeat for each row in the table.
For Each DBDataRow In DBDataTable.Rows
lvDate.Items.Add(CDate(DBDataRow("DateCours").ToString))
lvDate.Items(0).SubItems.Add(DBDataRow("nbPersonne").ToString)
lvDate.Items(0).SubItems.Add(DBDataRow("GroupeID").ToString)
Next
Next
DataGrid1.CaptionText = Table
'Set the DataSource and DataMember Property of DataGrid
DataGrid1.DataSource = DBDataSet
'DataGrid1.DataMember = Table
End Sub
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 201934 19 oct. 2004 à 01:00
essayons autre chose
Dim LviItem As ListViewItem
Dim LsiSubItem As ListViewItem.ListViewSubItem
LvDate.View = View.Details
For Each DBDataTable In DBDataSet.Tables
For Each DBDataRow In DBDataTable.Rows
LviItem = LvDate.Items.Add(CDate(DBDataRow("DateCours").ToString))
' LviItem.UseItemStyleForSubItems = False
LsiSubItem = LviItem.SubItems.Add(DBDataRow("nbPersonne").ToString)
' LsiSubItem.ForeColor = Color.Red
LsiSubItem = LviItem.SubItems.Add(DBDataRow("GroupeID").ToString)
' LsiSubItem.ForeColor = Color.Purple
Next
Next
cs_Creat
Messages postés76Date d'inscriptiondimanche 25 juillet 2004StatutMembreDernière intervention20 mars 2006 19 oct. 2004 à 05:18
Wow,Merci beaucoup et j'ai ajouté la coucleur comme tu as mis en commentaire et pour plus de rapidité j'ai enlevé le .tostring comme suis :
Dim LviItem As ListViewItem
Dim LsiSubItem As ListViewItem.ListViewSubItem
For Each DBDataTable In DBDataSet.Tables
'Repeat for each row in the table.
For Each DBDataRow In DBDataTable.Rows
LviItem = lvDate.Items.Add(CDate(DBDataRow("DateCours")))
LviItem.UseItemStyleForSubItems = False
LsiSubItem = LviItem.SubItems.Add(DBDataRow("nbPersonne"))
LsiSubItem.ForeColor = Color.Red
LsiSubItem = LviItem.SubItems.Add(DBDataRow("GroupeID"))
LsiSubItem.ForeColor = Color.Purple
Next
Next