Estoy agregando dinámicamente un control SSTab a un Formulario. Desearía
saber cómo agregar otros controles dinámicamente (por ejemplo un
CommandButton) a las diferentes fichas del SSTab, ya que al hacerlo mediante
el código abajo mostrado, los controles se agregan a la primera ficha. En
concreto que código debo utilizar para agregar un control dinámicamente, por
ejemplo a la ficha 2.
Private WithEvents Etiq As SSTab
Private WithEvents Boton As CommandButton
Private Sub Form_Load()
Set Etiq = Me.Controls.Add("TabDlg.SSTab", "etq")
With Etiq
.Visible = True
.TabCaption(0) = "ficha 1"
.TabCaption(1) = "ficha 2"
.TabCaption(2) = "ficha 3"
.Width = 3700
.Height = 2500
.Top = 1500
.Left = 2500
End With
Set Boton = Me.Controls.Add("VB.CommandButton", "cmd", Etiq)
With Boton
.Visible = True
.Top = 500
.Left = 500
End With
End Sub
Desde ya muchísimas gracias.
Carlos
Option Explicit
Private WithEvents sst As SSTab
Private WithEvents btn1 As CommandButton
Private WithEvents btn2 As CommandButton
Private WithEvents btn3 As CommandButton
Private Sub Form_Click()
Set sst = Controls.Add("TabDlg.SSTab", "sst")
With sst
.TabCaption(0) = "Ficha 1"
.TabCaption(1) = "Ficha 2"
.TabCaption(2) = "Ficha 3"
.Move 120, 120, 4800, 4800
.Visible = True
End With
sst.Tab = 0
Set btn1 = Controls.Add("VB.CommandButton", "btn1", sst)
With btn1
.Move 360, 720, 900, 600
.Visible = True
End With
sst.Tab = 1
Set btn2 = Controls.Add("VB.CommandButton", "btn2", sst)
With btn2
.Move 480, 840, 900, 600
.Visible = True
End With
sst.Tab = 2
Set btn3 = Controls.Add("VB.CommandButton", "btn3", sst)
With btn3
.Move 600, 960, 900, 600
.Visible = True
End With
End Sub
Un saludo!
Rubén Vigón
Microsoft MVP Visual Basic
http://www.mvp-access.com/rubenvigon
Carlos
"Carlos García" <granr...@yahoo.com.ar> escribió en el mensaje
news:#lgEHXbW...@TK2MSFTNGP10.phx.gbl...