Afficher 2 colonne dans une liste box

hy_honey Messages postés 67 Date d'inscription lundi 9 mai 2005 Statut Membre Dernière intervention 8 août 2005 - 3 août 2005 à 16:54
rabeb83 Messages postés 2 Date d'inscription jeudi 23 novembre 2000 Statut Membre Dernière intervention 8 août 2005 - 8 août 2005 à 10:59
salut a tous je cherche a affiché 2 colone dans une liste boxe je suis en vb6.net et je sais pas trop coment faire le code que j'ai fais me récupere seulement une seul colonne et je sais pas se que je doit changer si quelqu'un peu m'aider voici mon code merci


ListBox1.DataSource = tempdataset2.Tables("mytempo2")


ListBox1.ValueMember = "clrepr"


ListBox1.DisplayMember = "clncli"

2 réponses

nhervagault Messages postés 6063 Date d'inscription dimanche 13 avril 2003 Statut Membre Dernière intervention 15 juillet 2011 37
3 août 2005 à 20:00
Salut

Private Sub button1_Click(sender As Object, e As System.EventArgs)
' Create an instance of the ListBox.
Dim listBox1 As New ListBox()
' Set the size and location of the ListBox.
listBox1.Size = New System.Drawing.Size(200, 100)
listBox1.Location = New System.Drawing.Point(10, 10)
' Add the ListBox to the form.
Me.Controls.Add(listBox1)
' Set the ListBox to display items in multiple columns.
listBox1.MultiColumn = True
' Set the selection mode to multiple and extended.
listBox1.SelectionMode = SelectionMode.MultiExtended

' Shutdown the painting of the ListBox as items are added.
listBox1.BeginUpdate()
' Loop through and add 50 items to the ListBox.
Dim x As Integer
For x = 1 To 50
listBox1.Items.Add("Item " & x.ToString())
Next x
' Allow the ListBox to repaint and display the new items.
listBox1.EndUpdate()

' Select three items from the ListBox.
listBox1.SetSelected(1, True)
listBox1.SetSelected(3, True)
listBox1.SetSelected(5, True)

' Display the second selected item in the ListBox to the console.
System.Diagnostics.Debug.WriteLine(listBox1.SelectedItems(1).ToString())
' Display the index of the first selected item in the ListBox.
System.Diagnostics.Debug.WriteLine(listBox1.SelectedIndices(0).ToString())

End Sub

Pourquoi tu n'utilises pas de datagrid c'est mieux pour faire ce que tu veux je pense.
0
rabeb83 Messages postés 2 Date d'inscription jeudi 23 novembre 2000 Statut Membre Dernière intervention 8 août 2005
8 août 2005 à 10:59
je veux afficher un tableau dans mon interface vb qui contient les élèments d'une table d'une base access,j'ai utillisé in datagrid mais elle ne fonctionne pas ,je ne sais pas quel est le problème,svp aidez moi avec un code et merci
0
Rejoignez-nous