Bonjour,

J'ai crée une application qui lit un fichier XML et crée un bouton selon des noeuds. Voici mon code pour créer un bouton par noeud trouvé.

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
23
24
25
26
27
28
29
30
31
32
        Dim xmlDoc As XmlDocument
        Dim xml_nodelist As XmlNodeList
        Dim m_node As XmlNode
        'Dim list_saison As List(Of String)
        'Create the XML Document
 
        xmlDoc = New XmlDocument()
        'Load the Xml file
 
        xmlDoc.Load("mots.xml")
        'Get the list of name nodes 
 
        xml_nodelist = xmlDoc.SelectNodes("/mot/saison")
 
        Dim btn As New Button
        Dim x As Integer = 200
        Dim y As Integer = 200
 
        'Loop through the nodes
        For Each m_node In xml_nodelist
            'Get the Gender Attribute Value
 
            Dim saisonAttribute = m_node.Attributes.GetNamedItem("saison").Value
 
            btn.Location = New Drawing.Point(x, y)
            btn.Text = "Saison " + saisonAttribute
 
            Me.Controls.Add(btn)
 
            y += 40
 
        Next
J'aimerai lié un évènement à chaque bouton crée mais je ne sais pas comment faire. Avez vous des idées ?

Merci