Foros del Web » Programación para mayores de 30 ;) » .NET »

cómo crear textbox dentro de un tab control en tiempo de ejecución

Estas en el tema de cómo crear textbox dentro de un tab control en tiempo de ejecución en el foro de .NET en Foros del Web. Hola, alguien sabe como crear un text box dentro de un tab control en tienmpo de ejecución, tengo parte del código que crea el tab, ...
  #1 (permalink)  
Antiguo 28/04/2005, 18:03
 
Fecha de Ingreso: agosto-2003
Ubicación: Cancun
Mensajes: 97
Antigüedad: 20 años, 8 meses
Puntos: 0
cómo crear textbox dentro de un tab control en tiempo de ejecución

Hola, alguien sabe como crear un text box dentro de un tab control en tienmpo de ejecución, tengo parte del código que crea el tab, pero no se como agregarle el textbox

saludos

Private Sub Nuevo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNuevo.Click
Dim TextB As System.Windows.Forms.TextBox
Dim NewPage As New System.Windows.Forms.TabPage
Static nVeces As Integer = 0

nVeces += 1
NewPage.Text = nVeces.ToString
Tab.TabPages.Add(NewPage)
Tab.TabPages(nVeces - 1).Container.Add(TextB)
End Sub
  #2 (permalink)  
Antiguo 28/04/2005, 22:32
 
Fecha de Ingreso: junio-2002
Mensajes: 212
Antigüedad: 21 años, 10 meses
Puntos: 0
Aca tenes un ejemplo... copialo y pegalo para que veas la onda...

Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TabControl1 As System.Windows.Forms.TabControl
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TabPage1 As System.Windows.Forms.TabPage
Friend WithEvents TabPage2 As System.Windows.Forms.TabPage
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TabControl1 = New System.Windows.Forms.TabControl
Me.Button1 = New System.Windows.Forms.Button
Me.TabPage1 = New System.Windows.Forms.TabPage
Me.TabPage2 = New System.Windows.Forms.TabPage
Me.TabControl1.SuspendLayout()
Me.SuspendLayout()
'
'TabControl1
'
Me.TabControl1.Controls.Add(Me.TabPage1)
Me.TabControl1.Controls.Add(Me.TabPage2)
Me.TabControl1.Location = New System.Drawing.Point(7, 8)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 0
Me.TabControl1.Size = New System.Drawing.Size(261, 202)
Me.TabControl1.TabIndex = 0
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(25, 237)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(74, 26)
Me.Button1.TabIndex = 1
Me.Button1.Text = "Button1"
'
'TabPage1
'
Me.TabPage1.Location = New System.Drawing.Point(4, 22)
Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Size = New System.Drawing.Size(253, 176)
Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = "TabPage1"
'
'TabPage2
'
Me.TabPage2.Location = New System.Drawing.Point(4, 22)
Me.TabPage2.Name = "TabPage2"
Me.TabPage2.Size = New System.Drawing.Size(253, 176)
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "TabPage2"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TabControl1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.TabControl1.ResumeLayout(False)
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x() As TextBox, i As Int16
For i = 0 To 5
ReDim Preserve x(i)
x(i) = New TextBox
x(i).Text = "Boton " & i
If i <> 0 Then
x(i).Top = x(i - 1).Top + x(i).Height
End If
TabPage1.Controls.Add(x(i))
Next
End Sub
__________________
Simuladores y Examenes Cisco, Herramientas de Red Online - Tecnologia y Redes
  #3 (permalink)  
Antiguo 30/04/2005, 11:31
 
Fecha de Ingreso: junio-2002
Mensajes: 212
Antigüedad: 21 años, 10 meses
Puntos: 0
te sirvio o no te sirvio?
__________________
Simuladores y Examenes Cisco, Herramientas de Red Online - Tecnologia y Redes
  #4 (permalink)  
Antiguo 21/12/2009, 11:42
 
Fecha de Ingreso: octubre-2009
Mensajes: 3
Antigüedad: 14 años, 7 meses
Puntos: 0
agregarcontroles a un tabcontrol

hola comunidad saludos coordiales necesito ayuda con un tabcontrol, deseo agrgar otros controles (textbox, label,checkbox) a un tab pages de un tab control pero en tiempo de ejecucion, deso el codigo si alguien me puede ayudar; estoy trabajandoen visual basic.net 2005

gracias x su ayuda
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas (incluyéndote)




La zona horaria es GMT -6. Ahora son las 09:39.