Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
This Demonstrates how to Dynamically add controls ...
Author:
Alex
E-mail:
Click to e-mail author
Submitted:
11/8/2001
Version:
VB5
Compatibility:
VB5, VB6
Category:
Forms
Views:
13366
This Demonstrates how to Dynamically add controls During Run-Time which means that a user could click on a command button or whatever you would have and add a text box to the form which this does. Not only does it do that, it also demonstrates how to drag and drop. Suprisingly simple code that even Novices can understand.
Declarations:
'Alex 'Add a command button and a text to the form 'Leave the Default names Dim TextNum As Integer
Code:
Private Sub Command1_Click() Load Text1(TextNum) Text1(TextNum).Left = Command1.Left Text1(TextNum).Top = Command1.Top Text1(TextNum).Visible = True Text1(TextNum).Drag TextNum = TextNum + 1 End Sub Private Sub Form_DragDrop(Source As Control, X As Single, Y As Single) Source.Left = X Source.Top = Y End Sub Private Sub Form_Load() TextNum = 1 End Sub Private Sub Text1_DragOver(Index As Integer, Source As Control, X As Single, Y As Single, State As Integer) Select Case State Case vbEnter Source.MousePointer = 12 Case vbLeave Source.MousePointer = 0 End Select End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement