Ver Mensaje Individual
  #4 (permalink)  
Antiguo 05/10/2011, 08:15
Avatar de lokoman
lokoman
 
Fecha de Ingreso: septiembre-2009
Mensajes: 502
Antigüedad: 14 años, 7 meses
Puntos: 47
Respuesta: Crear ComboBox y TextBox desde VB6.0

1-El apartado "FORMA" hace lo que pediste: "el formulario se ajuste a la nueva linea", o sea, al añadir un nuevo TEXTBOX, LABEL, etc. el formulario AUMENTA su tamaño, pero esto solo pasa si los controles llegan a la parte inferior del formulario

2-El indice=0 es porque los controles que se cargan pertenecen a un ARREGLO, por eso la instruccion LOAD. Hay otra forma:

http://msdn.microsoft.com/en-us/libr...(v=vs.80).aspx

Código vb:
Ver original
  1. ' Visual Basic 6.0
  2. Private Sub Command1_Click()
  3.     ' Declare a new Control variable.
  4.    Dim c As Control
  5.     ' Create and add the new control.
  6.    Set c = Controls.Add("VB.TextBox", "Text1")
  7.     ' Make the new control visible.
  8.    c.Visible = True
  9.     ' Set the initial text.
  10.    c.Text = "Hello"
  11.     ' Retrieve the text from the new TextBox.
  12.    If Controls.Count > 1 Then
  13.         MsgBox (Controls("Text1").Text)
  14.     End If
  15.     ' Remove the new control.
  16.    Controls.Remove (Text1)
  17.     ' The following line causes a compilation error.
  18.    ' You cannot remove controls added at design time.
  19.    Controls.Remove (Command1)
  20. End Sub

3-El UNLOAD es para descargar objetos, el TOP no se reduce automáticamente, cuando uso el LOAD el TOP lo calculo para que no queden los controles unos sobre otros, el UNLOAD solo quita el objeto que le dices, si quitas el TEXTBOX numero 3, el TEXTBOX numero 4 (que esta abajo), no va a subir, hay que calcularle el TOP

4-Es valido para todos los controles de VB, si son un arreglo (indice=0)

5-Con el codigo de ejemplo del punto numero 2, puedes cargar cualquier objeto, solo debes ponerle un nombre diferente a cada uno