Results 1 to 6 of 6

Thread: [RESOLVED] What is the class ID for a textbox

  1. #1

    Thread Starter
    Lively Member blaff's Avatar
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    69

    Unhappy [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.

  2. #2
    Lively Member
    Join Date
    Aug 2002
    Posts
    126
    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

  3. #3

    Thread Starter
    Lively Member blaff's Avatar
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    69
    YESSS!!!

    That works! Thank you!

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    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).

  5. #5

    Thread Starter
    Lively Member blaff's Avatar
    Join Date
    Nov 2002
    Location
    Germany
    Posts
    69
    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

  6. #6
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    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
  •  



Click Here to Expand Forum to Full Width