|
-
Dec 5th, 2002, 06:26 AM
#1
Thread Starter
Lively Member
[RESOLVED] What is the class ID for a textbox
Hello,
hopefully somebody can help me with this:
I'm creating a form on wich I dynamically create controls.
Background:
With my app a user can execute an sql-statement on several sql-servers at once.
After the processing he will get a form with the results.
On the form is Tab-Control (TabOne from ComponentOne). I can dynamically create tabs with this control and attach other controls to this tabs.
I want to create a text-box showing the results. But my problem is: I don't know the class-iD of a textbox. Right now I'm using:
Code:
Dim rt As Object
Set rt = Controls.Add("Forms.TextBox.1", "rt" & x)
This works fine for me. But the created control is not the same as a textbox I create during design-time in VB. I think the Forms.TextBox.1 comes with office and I can't make sure that my customers have office installed (and if yes in which version).
I tried to use Spy++ to find out the class-ID, but it says "ThunderTextBox" which is not a valid Class-ID.
I searched the registry without luck. I tried to use the OLE/COM Object view from VS6, but I can't find the right classID!
Any Ideas
Last edited by blaff; Dec 5th, 2002 at 11:18 AM.
-
Dec 5th, 2002, 07:13 AM
#2
Lively Member
draw textbox on a form and change its index property to 0
the following code add textbox dynamically:
Load Text1(Text1.UBound + 1)
Text1(Text1.UBound).Top = Text1(Text1.UBound - 1).Top + Text1(Text1.UBound - 1).Height
Text1(Text1.UBound).Visible = True
-
Dec 5th, 2002, 07:29 AM
#3
Thread Starter
Lively Member
YESSS!!!
That works! Thank you!
-
Dec 5th, 2002, 11:29 AM
#4
But my problem is: I don't know the class-iD of a textbox
Use the class id from the VB library
Set objCtrl = Controls.Add("VB.TextBox", "TextBoxName")
Set objCtrl = Controls.Add("VB.ComboBox", "ComboBoxName")
ThunderTextBox is the window class used to create an instance of a TextBox (Thunder was the code name used by Microsoft when it was developing VB).
-
Dec 5th, 2002, 11:44 AM
#5
Thread Starter
Lively Member
Thanks!
Do you know a generally good way to detect the className of a control?
Most of the time the OLE/COM Object-Viewer is very helpful, but in this case I haven't found the className!
Originally posted by brucevde
ThunderTextBox is the window class used to create an instance of a TextBox (Thunder was the code name used by Microsoft when it was developing VB).
You sure know the details
-
Dec 5th, 2002, 12:37 PM
#6
I just use the Object Browser. It contains the library/project name and the different class names. For third party controls you will need to add a reference to the component.
I rarely use the Controls.Add method as I prefer the method of adding a control to an existing control array outlined by deja.
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
|