Results 1 to 3 of 3

Thread: create control derived of another control

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Posts
    2

    create control derived of another control

    Hello, bear with me I am new in this, I want to build a control derived of the textbox control with its properties and events, How can I create it?

    Thank

  2. #2
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246
    Ok, ive posted this before, but its pretty simple to get used to. Im guessing you want to make an Object from scratch. You want that object to be a textbox. Ok, first off, u need to Dimension an Object. So;


    Dim newcmdbutton As Object

    Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
    If Text1.Text = "CommandButton" Then
    Set newcmdbutton = Form1.Controls.Add("VB.COMMANDBUTTON", "Command1")
    newcmdbutton.Height = 495
    newcmdbutton.Width = 1215
    newcmdbutton.Left = 30
    newcmdbutton.Top = 30
    newcmdbutton.Caption = "Command1"
    newcmdbutton.Visible = True
    End If
    End If
    End Sub



    Basically, what that does is, If you type CommandButton into a TextBox called Text1, and press Enter(KeyCode 13) it creates a new CommandButton called Command1. Hope this gives you hope.


    «°°phReAk°°»

    Visual Studio 6, Visual Studio.NET 2005, MASM

  3. #3
    PowerPoster Arc's Avatar
    Join Date
    Sep 2000
    Location
    Under my rock
    Posts
    2,336
    The easiest way is to use the ActiveX control Interface wizard in your Add ins menu.


    Put a textbox on your Control then run the wizard.. when it gets to the "maps to" part select the property you want to use and select the textbox in the drop down comobo box under "maps to".
    -We have enough youth. How about a fountain of "Smart"?
    -If you can read this, thank a teacher....and since it's in English, thank a soldier.


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