Creating a Text Box In a Class

Ok so, so i have a class.

Public Class ChatTab : Inherits TabPage

If i wanted to create a new text box on it How would i do it



Answer this question

Creating a Text Box In a Class

  • Prabagarane

    Its not working... I dont see it

    Private WithEvents Topic As new textbox

    Public Sub New()
    Topic.BackColor = Color.Red
    Topic.Size = New Size(200, 200)
    Topic.text = "Testing"
    Topic.Location = New Point(1, 2)

    End Sub


  • Kyndig

    Joshizzle wrote:
    Its not working... I dont see it

    Private WithEvents Topic As new textbox

    Public Sub New()
    Topic.BackColor = Color.Red
    Topic.Size = New Size(200, 200)
    Topic.text = "Testing"
    Topic.Location = New Point(1, 2)
    Me.Controls.Add(Topic)
    End Sub



  • jonesbrasil

    The way im using it is like this.

    tabcontrol1.tabpages.add(new chattab)


  • Raja Nadar

    Public Class ChatTab

    Inherits TabPage

    Private WithEvents txtbx as New TextBox

    Public Sub New()

    With txtbx

    .Location=...

    .Name=...

    'Set other properties here

    End WIth

    Me.Controls.Add(txtbx)

    End Sub

    end Class




  • kwards3

    Make sure you add the control to the form after you create it.
  • Creating a Text Box In a Class