Bonjour,

Je voudrais générer une listbox ou une listview avec des information à l'intérieur dans un tableLatoutPanel. Mon problème, c'est je ne sais pas exactement comment écrire le code. Voici mon début de code pour la form avec laquel j'ajoute mes infos dans la listbox:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Public Class frmAjouter
 
    Private Sub btnAjouter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAjouter.Click
        Dim intCoordoneH As Integer = 0
        Dim intCoordineJ As Integer = 0
        StrNom = txtNomEvenement.Text
        strLieu = txtlieu.Text
        strDetail = txtDetails.Text
        If CBool(cbxHeure.SelectedIndex) Then
            intCoordoneH = cbxHeure.SelectedIndex + 1
        End If
        If CBool(cbxJour.SelectedIndex) Then
            intCoordineJ = cbxJour.SelectedIndex + 1
        End If
        'frmHoraire.listbox.Location = New System.Drawing.Point(intCoordineJ, intCoordoneH)
        frmHoraire.Controls.Add(lstEvenement)
        frmHoraire.Show()
        Me.Close()
    End Sub
End Class
Ensuite, voici mon code pour ma form ou la listbox est ajouter:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Public Class frmHoraire
    Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click
        Me.Hide()
    End Sub
 
    Private Sub btnQuit2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit2.Click
        Application.Exit()
    End Sub
 
    Private Sub btnAjouter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAjouter.Click
        frmAjouter.ShowDialog()
        Me.Close()
    End Sub
 
    Private Sub frmHoraire_VisibleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.VisibleChanged
        If Visible = True Then
            lstEvenement.Items.Add(StrNom)
            lstEvenement.Items.Add(strLieu)
            lstEvenement.Items.Add(strDetail)
        End If
    End Sub
End Class
Si quelqu'un peut m'aider j'aprécirais beaucoup.

Merci d'avance

Francis