hello everybody,
how to add combobox and DTPicker at runtime to a form?
Thanks in advance
:) :wave:
Printable View
hello everybody,
how to add combobox and DTPicker at runtime to a form?
Thanks in advance
:) :wave:
Here is a sample using command buttons and textboxs.
The principle is the same.
Thanx for the reply.
but my problem is with DTP
the above line gives me an error "Invalid class string..."Code:Set DTP = Me.Controls.Add("VB.DTPicker", "DTP1")
That's because it isn't VB.DTPicker.... I think the actual class string is longer than that as it's part of a different library from just VB.... and I believe it's ".DateTimePicker"
-tg
doesn't work :cry:Quote:
".DateTimePicker"
it seems to be the above, but there is another problem.Code:Set DTP = Me.Controls.Add("MSCOMCTL2.DTPicker.2", "DTP1")
Quote:
"MSCOMCTL2.DTpicker.2" cannot be added because it is referenced but not in use by any items in the project. To correct this, uncheck 'remove information about unused ActiveX controls' in the project options
:cry:Code:Private Sub Form_Load()
Set DTP = Me.Controls.Add("MSCOMCTL2.DTPicker.2", "DTP1")
DTP.Height = 500
DTP.Width = 500
DTP.Top = 500
DTP.CheckBox = True
DTP.Value = Now
DTP.Visible = True
End Sub
while we are splitting our hairs :eek: on DTP, how to set the .Style property of the combo created in runtime :blush: MSDN says that .Style allows only design time manipulations and read only during runtime. :sick:
:afrog:
That is true even if you added it at design time.
so how do you guys manipulate the combo at runtime :confused:Quote:
Originally Posted by Hack
I was googling for the combo problem I found this link on the similar issue but I am not able to make anything out of it. Can somebody confirm the issue there is same as mine, if so how do I implement the same (i.e usage)
I haven't tested the code in that link. But from the looks of it, it's awesome:thumb:Quote:
Originally Posted by VBFnewcomer
If it works then yes you need to do it that way. but remember what the author has to say...
Quote:
Of course the drawback there is VB will know nothing
about it and you'll have to use strictly Api methods with it, plus
subclassing for all events.
Thanks Kool :afrog:
how do I use it?? Like if I want the combo in a particular style how do I go about it :confused: