Application HTA en VBScript : problème sur reset de ListBox dynamique

Résolu
cs_JMO Messages postés 1854 Date d'inscription jeudi 23 mai 2002 Statut Membre Dernière intervention 24 juin 2018 - 29 nov. 2012 à 20:57
cs_JMO Messages postés 1854 Date d'inscription jeudi 23 mai 2002 Statut Membre Dernière intervention 24 juin 2018 - 30 nov. 2012 à 13:17
 Bonsoir le Forum,

Je transforme un .vbs en application HTA.
Je rencontre plusieurs problèmes.
Conformément au Forum, chaque question sera distincte.

Question:
Dans le body, création d'une ListBox dynamique.
<SELECT NAME="lstClient">
</SELECT>


Dans ma "Sub Window_onLoad"

    ' Initialisation objet ArrayList
    Set MyArrayList = CreateObject("System.Collections.ArrayList")

    For i=2 To UBound(arrConfigLine)
        strClient = Split(arrConfigLine(i), Chr(58))(0)
        If InStr(1, strClient, "SAVEMUTU") = 0 Then MyArrayList.Add Trim(strClient)
    Next

    ' Tri de la collection ArrayList
    MyArrayList.Sort
    MyArrayList.insert 0, "Choix du client VTOM" & Space(8)

    ' Création ListBox dynamique
    For i=0 To MyArrayList.Count-1
        Set objOption = Document.CreateElement("OPTION")
        objOption.Text = MyArrayList(i)
objOption.Value = MyArrayList(i)             
lstClient.Add(objOption)
    Next


Dans un bouton
Sub btnRelaunchApp_OnClick
    txtLog.Value = vbNullString
    btnVTOM.Disabled = False
    btnSAVEMUTU.Disabled = False
    btnQuitApp.disabled = False
    lstClient.Disabled = True
    lstSAVEMUTU.Disabled = True
    Call Window_onLoad
End Sub 




Question:
Comment dans la sub "btnRelaunchApp_OnClick", repositionner à 0 l'index de ma ListBox "lstClient" ???

Merci d'avance de vos propositions.



jean-marc

1 réponse

cs_JMO Messages postés 1854 Date d'inscription jeudi 23 mai 2002 Statut Membre Dernière intervention 24 juin 2018 27
30 nov. 2012 à 13:17
 Bonjour à tous

Réponse pour réinitiliser une ListBox dynamique.
    For Each objOption in lstClient.Options
        objOption.RemoveNode
    Next


jean-marc
3
Rejoignez-nous