IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB 6 et antérieur Discussion :

besoin d'aide pour la création d'un drag and drop


Sujet :

VB 6 et antérieur

  1. #1
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Décembre 2007
    Messages
    696
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Décembre 2007
    Messages : 696
    Points : 222
    Points
    222
    Par défaut besoin d'aide pour la création d'un drag and drop
    bonjour, j'aimerais réaliser un drag and drop avec 2 listbox, enfin je pense que ca s'appelle comme ça.
    comme le truc qu'on voit dans l'onglet confidentialité de msn, vous voyez ?
    travaillant depuis peu de temps sur vb6, je ne sais pas du tout comment m'y prendre...

    je dois travailler à partir de la requete SQL suivante :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    select code_personne, nom, prenom, FROM personne
    pourriez-vous partager un script qui serait susceptible de m'aider svp ?

    merci beaucoup

  2. #2
    Membre habitué
    Inscrit en
    Février 2007
    Messages
    327
    Détails du profil
    Informations forums :
    Inscription : Février 2007
    Messages : 327
    Points : 127
    Points
    127
    Par défaut
    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
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    Private Sub Form_Load()
        ' Populate the list
        List1.AddItem "James"
        List1.AddItem "Frederick"
        List1.AddItem "Ann"
        List1.AddItem "Paul"
        List1.AddItem "Sarah"
        List1.OLEDropMode = 1
        List2.OLEDropMode = 1
    End Sub
     
    ' Code managing dropping from list one
    ' to list two
    Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        List1.OLEDrag    ' Begin dragging
    End Sub
    Private Sub List1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
        ' Only allow moves
        AllowedEffects = vbDropEffectMove
        ' Assign the ListBox selection to the DataObject
        Data.SetData List1
    End Sub
    Private Sub List2_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim strList As String
        ' Check the format of the DataObject
        If Not Data.GetFormat(vbCFText) Then Exit Sub
        ' Retrieve the text from the DataObject
        strList = Data.GetData(vbCFText)
        ' If the item was not dropped on itself
        If Not strList = List2.Text Then
            List2.AddItem strList
            'Remove the item from the ListBox
            List1.RemoveItem List1.ListIndex
        End If
    End Sub
    ''
    ''
    '' Code managing dropping from list one
    '' to list two
    ''
    Private Sub List2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        List2.OLEDrag    ' Begin dragging
    End Sub
    Private Sub List2_OLEStartDrag(Data As DataObject, AllowedEffects As Long)
        ' Only allow moves
        AllowedEffects = vbDropEffectMove
        ' Assign the ListBox selection to the DataObject
        Data.SetData List2
    End Sub
    Private Sub List1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
        Dim strList As String
        ' Check the format of the DataObject
        If Not Data.GetFormat(vbCFText) Then Exit Sub
        ' Retrieve the text from the DataObject
        strList = Data.GetData(vbCFText)
        ' If the item was not dropped on itself
        If Not strList = List1.Text Then
            List1.AddItem strList
            'Remove the item from the ListBox
            List2.RemoveItem List2.ListIndex
        End If
    End Sub

  3. #3
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Décembre 2007
    Messages
    696
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Seine Maritime (Haute Normandie)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Décembre 2007
    Messages : 696
    Points : 222
    Points
    222
    Par défaut
    merci beaucoup, j'essairai ce code ce soir.
    j'espere ( et je pense ) que ca marchera ^^


Discussions similaires

  1. besoin d'aide pour la création d'une requête
    Par fabien59420 dans le forum Requêtes et SQL.
    Réponses: 5
    Dernier message: 11/06/2008, 15h29
  2. besoin d'aide pour la création d'un requête
    Par fabien59420 dans le forum Requêtes et SQL.
    Réponses: 19
    Dernier message: 21/05/2008, 11h41
  3. besoin d'aide pour la création d'un logiciel
    Par lemoinedu49 dans le forum Macros et VBA Excel
    Réponses: 1
    Dernier message: 21/12/2007, 06h21
  4. Réponses: 3
    Dernier message: 26/06/2007, 14h53
  5. Réponses: 2
    Dernier message: 10/03/2006, 13h55

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo