Tutorial: Visual Basic

Tutorials | Html Introduction | Basic Html Code | Html Code for Layers

Drag Drop Property

This simple program uses the DragDrop property: It enables you to drag the text you put in the text box onto the blue shaped label.

  • Form
    Place a text box, two labels and a Command button on the form.

  • Properties
    Text Box
    Name: txtmessage
    DragMode: 1 –Automatic (vbAutomatic)
    Text: Text Box

    Label 1
    Name: lblblue
    Caption: none
    Backcolor: blue

    Label 2
    Name: lblwhite
    Caption: Type in the text box then drag it onto the blue rectangle.

    Command Button
    Name: cmdExit

  • Double click on the blue label. Use the drop down menu to select DragDrop.
    Type the following code in the event procedure:

    Private Sub lblblue_DragDrop(Source As Control, X As Single, Y As Single)
    lblblue.Caption = Source.Text

Note: If you have any .ico images you can click on the DragIcon property and select your .ico image. This icon will then be seen as you drag the text onto the blue shape.

© J. K. Phillips     Disclaimer
Current URL: