|
-
May 5th, 2000, 05:06 AM
#1
Thread Starter
Addicted Member
How do you add a command button or form through code and then determine its location ?
-
May 5th, 2000, 05:26 AM
#2
transcendental analytic
Very recently there have been at least two of this kind of qwestions, go search for them
And what do you mean with location?!?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 5th, 2000, 05:31 AM
#3
If you have VB5 you can only create controls by loading control arrays. In VB6, you can create them from scratch.
-
May 5th, 2000, 05:31 AM
#4
Thread Starter
Addicted Member
actually i always search before i ask a question; and if there are two questions i have not found them or the right syntax for the search. If you don't want to help that is fine -- but what exactly was your point?
-
May 5th, 2000, 06:47 AM
#5
Frenzied Member
How do you create them from scratch in vb6?
-
May 5th, 2000, 07:03 AM
#6
I don't have VB6, so I don't know. i remember some one saying somthing like...
Controls.Add
OR
Toolbox.Add
As I said, i don't Really know. But it might be somthing like that. Try using that statement and then VB will give you the rest by guiding you with the ToolTipText and the
Combo boxes as you type.
-
May 5th, 2000, 08:14 AM
#7
i know there is a way to do it from scratch in VB6 but I forogt how. Could someone who has VB6 try the methods i listed before and tell me if they work?
-
May 5th, 2000, 08:23 AM
#8
Thread Starter
Addicted Member
No nothing no toolbox and controls doesn't work as far as my knowledge takes me which is typing it and seeing what the choices are as the tooltips appear :P
-
May 5th, 2000, 06:18 PM
#9
transcendental analytic
I can't see how to create a control under runtime, i have vb5 but i don't think it's even possible under vb6 or is it?
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 11th, 2000, 04:31 PM
#10
New Member
Bebe,
I hope this is not to late. Here's the code I use to create checkboxes during run time.
Private Sub cmdAddCheckBoxes_Click()
Dim i As Integer 'The number of checkboxes
'Add checkboxes
For i = 1 To 3
'Use the DB2_Name as the control key
'strChkBoxName = "chkBox" & Trim(Str(iWS_Row - 1))
strkeyname = "CheckBox"
Set AddChkBox = UserForm1.Controls.Add("Forms.CheckBox.1", strkeyname, True)
With AddChkBox
.Caption = Str(i)
.FontSize = 8
.Top = 6 + (18 * (i - 1))
.Width = 150
.Left = 12
.Height = 18
'Check worksheet to see if db2 field was selected
End With
' colCheckBoxes.Add strkeyname
Next i
End Sub
-
Aug 11th, 2000, 04:55 PM
#11
Code:
Controls.Add "VB.CommandButton", "Command1"
Me!Command1.Move 0, 0
Me!Command1.Caption = "Command1"
Me!Command1.Visible = True
-
Aug 11th, 2000, 05:13 PM
#12
Or if you have VB5, use CreateWindowEx
Code:
Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" (ByVal dwExStyle _
As Long, ByVal lpClassName As String, ByVal lpWindowName As String, ByVal dwStyle _
As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight _
As Long, ByVal hWndParent As Long, ByVal hMenu As Long, ByVal hInstance As Long, lpParam As Any) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Const WS_CHILD = &H40000000
Private Sub Form_Load()
retval = CreateWindowEx(0&, "Button", "Button1", WS_CHILD, 32, 32, 64, 64, Me.hwnd, 0, App.hInstance, ByVal 0&)
ShowWindow retval, 1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|