Visual Basic.NET - ¿Cómo se puede cargar un GroupBox antes del Load del form?

 
Vista:
sin imagen de perfil
Val: 229
Ha disminuido 1 puesto en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

¿Cómo se puede cargar un GroupBox antes del Load del form?

Publicado por José Vicente (113 intervenciones) el 21/03/2021 12:26:01
Hola, tengo un problema con un GroupBox ya que quiero poner el foco en él desde el arranque y no hay manera. ¿Puede alguien echarme una mano? Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de melqui
Val: 643
Bronce
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

¿Cómo se puede cargar un GroupBox antes del Load del form?

Publicado por melqui (242 intervenciones) el 21/03/2021 14:11:31
tente asi dentro del tu formulario fuera del evento load

1
2
3
4
5
6
7
8
Public Sub New()
 
    ' Esta chamada é requerida pelo designer.
    InitializeComponent()
 
    ' Adicione qualquer inicialização após a chamada InitializeComponent().
 
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 229
Ha disminuido 1 puesto en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

¿Cómo se puede cargar un GroupBox antes del Load del form?

Publicado por José Vicente (113 intervenciones) el 22/03/2021 11:20:21
Hola, gracias por tu respuesta, pero no entiendo muy bien lo que me dices. En el initializeComponentes tengo:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
Private Sub InitializeComponent()
    Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1))
    Me.hematimetria_gbox = New System.Windows.Forms.GroupBox()
 
    Me.Label21 = New System.Windows.Forms.Label()
    Me.Label20 = New System.Windows.Forms.Label()
    Me.Label19 = New System.Windows.Forms.Label()
    Me.Label18 = New System.Windows.Forms.Label()
    Me.Label17 = New System.Windows.Forms.Label()
    Me.Label16 = New System.Windows.Forms.Label()
    Me.Label15 = New System.Windows.Forms.Label()
    Me.Label14 = New System.Windows.Forms.Label()
    Me.Label13 = New System.Windows.Forms.Label()
    Me.Label12 = New System.Windows.Forms.Label()
    Me.Label11 = New System.Windows.Forms.Label()
    Me.Label10 = New System.Windows.Forms.Label()
    Me.Label9 = New System.Windows.Forms.Label()
    Me.Label8 = New System.Windows.Forms.Label()
    Me.Label7 = New System.Windows.Forms.Label()
    Me.Label6 = New System.Windows.Forms.Label()
    Me.Label5 = New System.Windows.Forms.Label()
    Me.Label4 = New System.Windows.Forms.Label()
    Me.Label3 = New System.Windows.Forms.Label()
    Me.Label2 = New System.Windows.Forms.Label()
    Me.Label1 = New System.Windows.Forms.Label()
    Me.vpm_tbox = New System.Windows.Forms.TextBox()
    Me.plaquetas_tbox = New System.Windows.Forms.TextBox()
    Me.basofilos_tbox = New System.Windows.Forms.TextBox()
    Me.eosinofilos_tbox = New System.Windows.Forms.TextBox()
    Me.monocitos_tbox = New System.Windows.Forms.TextBox()
    Me.linfocitos_tbox = New System.Windows.Forms.TextBox()
    Me.neutrofilos_tbox = New System.Windows.Forms.TextBox()
    Me.basofilosA_tbox = New System.Windows.Forms.TextBox()
    Me.eosinofilosA_tbox = New System.Windows.Forms.TextBox()
    Me.monocitosA_tbox = New System.Windows.Forms.TextBox()
    Me.linfocitosA_tbox = New System.Windows.Forms.TextBox()
    Me.neutrofilosA_tbox = New System.Windows.Forms.TextBox()
    Me.leucocitos_tbox = New System.Windows.Forms.TextBox()
    Me.eritrocitos_tbox = New System.Windows.Forms.TextBox()
    Me.anchoDis_tbox = New System.Windows.Forms.TextBox()
    Me.chcm_tbox = New System.Windows.Forms.TextBox()
    Me.hcm_tbox = New System.Windows.Forms.TextBox()
    Me.vcm_tbox = New System.Windows.Forms.TextBox()
    Me.hematocrito_tbox = New System.Windows.Forms.TextBox()
    Me.hemoglobina_tbox = New System.Windows.Forms.TextBox()
    Me.hematies_tbox = New System.Windows.Forms.TextBox()
    Me.vpm_lbl = New System.Windows.Forms.Label()
    Me.plaquetas_lbl = New System.Windows.Forms.Label()
    Me.basofilos_lbl = New System.Windows.Forms.Label()
    Me.eosinofilos_lbl = New System.Windows.Forms.Label()
    Me.monocitos_lbl = New System.Windows.Forms.Label()
    Me.linfocitos_lbl = New System.Windows.Forms.Label()
    Me.neutrofilos_lbl = New System.Windows.Forms.Label()
    Me.basofilosA_lbl = New System.Windows.Forms.Label()
    Me.eosinofilosA_lbl = New System.Windows.Forms.Label()
    Me.monocitosA_lbl = New System.Windows.Forms.Label()
    Me.linfocitosA_lbl = New System.Windows.Forms.Label()
    Me.neutrofilosA_lbl = New System.Windows.Forms.Label()
    Me.leucocitos_lbl = New System.Windows.Forms.Label()
    Me.eritrocitos_lbl = New System.Windows.Forms.Label()
    Me.anchoDis_lbl = New System.Windows.Forms.Label()
    Me.chcm_lbl = New System.Windows.Forms.Label()
    Me.hcm_lbl = New System.Windows.Forms.Label()
    Me.vcm_lbl = New System.Windows.Forms.Label()
    Me.hematocrito_lbl = New System.Windows.Forms.Label()
    Me.hemoglobina_lbl = New System.Windows.Forms.Label()
    Me.hematies_lbl = New System.Windows.Forms.Label()
    Me.GroupBox2 = New System.Windows.Forms.GroupBox()
    Me.Label39 = New System.Windows.Forms.Label()
    Me.Label38 = New System.Windows.Forms.Label()
    Me.Label37 = New System.Windows.Forms.Label()
    Me.Label36 = New System.Windows.Forms.Label()
    Me.Label35 = New System.Windows.Forms.Label()
    Me.Label34 = New System.Windows.Forms.Label()
    Me.Label33 = New System.Windows.Forms.Label()
    Me.Label32 = New System.Windows.Forms.Label()
    Me.Label31 = New System.Windows.Forms.Label()
    Me.Label30 = New System.Windows.Forms.Label()
    Me.Label29 = New System.Windows.Forms.Label()
    Me.Label28 = New System.Windows.Forms.Label()
    Me.Label27 = New System.Windows.Forms.Label()
    Me.Label26 = New System.Windows.Forms.Label()
    Me.Label25 = New System.Windows.Forms.Label()
    Me.Label24 = New System.Windows.Forms.Label()
    Me.Label23 = New System.Windows.Forms.Label()
    Me.Label22 = New System.Windows.Forms.Label()
    Me.osmolaridad_tbox = New System.Windows.Forms.TextBox()
    Me.hierro_tbox = New System.Windows.Forms.TextBox()
    Me.potasio_tbox = New System.Windows.Forms.TextBox()
    Me.sodio_tbox = New System.Windows.Forms.TextBox()
    Me.fosfatasa_tbox = New System.Windows.Forms.TextBox()
    Me.ggt_tbox = New System.Windows.Forms.TextBox()
    Me.gpt_tbox = New System.Windows.Forms.TextBox()
    Me.bilirrubina_tbox = New System.Windows.Forms.TextBox()
    Me.trigliceridos_tbox = New System.Windows.Forms.TextBox()
    Me.vldl_tbox = New System.Windows.Forms.TextBox()
    Me.ldl_tbox = New System.Windows.Forms.TextBox()
    Me.hdl_tbox = New System.Windows.Forms.TextBox()
    Me.colesterol_tbox = New System.Windows.Forms.TextBox()
    Me.urato_tbox = New System.Windows.Forms.TextBox()
    Me.fge_tbox = New System.Windows.Forms.TextBox()
    Me.creatinina_tbox = New System.Windows.Forms.TextBox()
    Me.urea_tbox = New System.Windows.Forms.TextBox()
    Me.glucosa_tbox = New System.Windows.Forms.TextBox()
    Me.osmolaridad_lbl = New System.Windows.Forms.Label()
    Me.hierro_lbl = New System.Windows.Forms.Label()
    Me.potasio_lbl = New System.Windows.Forms.Label()
    Me.sodio_lbl = New System.Windows.Forms.Label()
    Me.fosfatasa_lbl = New System.Windows.Forms.Label()
    Me.ggt_lbl = New System.Windows.Forms.Label()
    Me.gpt_lbl = New System.Windows.Forms.Label()
    Me.bilirrubina_lbl = New System.Windows.Forms.Label()
    Me.trigliceridos_lbl = New System.Windows.Forms.Label()
    Me.vldl_lbl = New System.Windows.Forms.Label()
    Me.ldl_lbl = New System.Windows.Forms.Label()
    Me.hdl_lbl = New System.Windows.Forms.Label()
    Me.colesterol_lbl = New System.Windows.Forms.Label()
    Me.urato_lbl = New System.Windows.Forms.Label()
    Me.fge_lbl = New System.Windows.Forms.Label()
    Me.creatinina_lbl = New System.Windows.Forms.Label()
    Me.urea_lbl = New System.Windows.Forms.Label()
    Me.glucosa_lbl = New System.Windows.Forms.Label()
    Me.GroupBox3 = New System.Windows.Forms.GroupBox()
    Me.Label43 = New System.Windows.Forms.Label()
    Me.Label42 = New System.Windows.Forms.Label()
    Me.Label41 = New System.Windows.Forms.Label()
    Me.Label40 = New System.Windows.Forms.Label()
    Me.ferritina_tbox = New System.Windows.Forms.TextBox()
    Me.apolipoproteina_tbox = New System.Windows.Forms.TextBox()
    Me.transferrinaI_tbox = New System.Windows.Forms.TextBox()
    Me.transferrinaS_tbox = New System.Windows.Forms.TextBox()
    Me.ferritina_lbl = New System.Windows.Forms.Label()
    Me.apolipoproteina_lbl = New System.Windows.Forms.Label()
    Me.transferrinaI_lbl = New System.Windows.Forms.Label()
    Me.transferrinaS_lbl = New System.Windows.Forms.Label()
    Me.GroupBox4 = New System.Windows.Forms.GroupBox()
    Me.Label44 = New System.Windows.Forms.Label()
    Me.t4_tbox = New System.Windows.Forms.TextBox()
    Me.t4_lbl = New System.Windows.Forms.Label()
    Me.nuevo_btn = New System.Windows.Forms.Button()
    Me.guardar_btn = New System.Windows.Forms.Button()
    Me.borrar_btn = New System.Windows.Forms.Button()
    Me.salir_btn = New System.Windows.Forms.Button()
    Me.fecha_lbl = New System.Windows.Forms.Label()
    Me.verde_pbox = New System.Windows.Forms.PictureBox()
    Me.rojo_pbox = New System.Windows.Forms.PictureBox()
    Me.fecha_mtbox = New System.Windows.Forms.MaskedTextBox()
    Me.Label45 = New System.Windows.Forms.Label()
    Me.analiticaNum_cbox = New System.Windows.Forms.ComboBox()
    Me.minimo_lbl = New System.Windows.Forms.Label()
    Me.maximo_lbl = New System.Windows.Forms.Label()
    Me.minimo_cbox = New System.Windows.Forms.ComboBox()
    Me.maximo_cbox = New System.Windows.Forms.ComboBox()
    Me.minValor_lbl = New System.Windows.Forms.Label()
    Me.maxValor_lbl = New System.Windows.Forms.Label()
    Me.hematimetria_gbox.SuspendLayout()
    Me.GroupBox2.SuspendLayout()
    Me.GroupBox3.SuspendLayout()
    Me.GroupBox4.SuspendLayout()
    CType(Me.verde_pbox, System.ComponentModel.ISupportInitialize).BeginInit()
    CType(Me.rojo_pbox, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'hematimetria_gbox
    '
    Me.hematimetria_gbox.BackColor = System.Drawing.Color.LightSalmon
    Me.hematimetria_gbox.Controls.Add(Me.Label21)
    Me.hematimetria_gbox.Controls.Add(Me.Label20)
    Me.hematimetria_gbox.Controls.Add(Me.Label19)
    Me.hematimetria_gbox.Controls.Add(Me.Label18)
    Me.hematimetria_gbox.Controls.Add(Me.Label17)
    Me.hematimetria_gbox.Controls.Add(Me.Label16)
    Me.hematimetria_gbox.Controls.Add(Me.Label15)
    Me.hematimetria_gbox.Controls.Add(Me.Label14)
    Me.hematimetria_gbox.Controls.Add(Me.Label13)
    Me.hematimetria_gbox.Controls.Add(Me.Label12)
    Me.hematimetria_gbox.Controls.Add(Me.Label11)
    Me.hematimetria_gbox.Controls.Add(Me.Label10)
    Me.hematimetria_gbox.Controls.Add(Me.Label9)
    Me.hematimetria_gbox.Controls.Add(Me.Label8)
    Me.hematimetria_gbox.Controls.Add(Me.Label7)
    Me.hematimetria_gbox.Controls.Add(Me.Label6)
    Me.hematimetria_gbox.Controls.Add(Me.Label5)
    Me.hematimetria_gbox.Controls.Add(Me.Label4)
    Me.hematimetria_gbox.Controls.Add(Me.Label3)
    Me.hematimetria_gbox.Controls.Add(Me.Label2)
    Me.hematimetria_gbox.Controls.Add(Me.Label1)
    Me.hematimetria_gbox.Controls.Add(Me.vpm_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.plaquetas_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.basofilos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.eosinofilos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.monocitos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.linfocitos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.neutrofilos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.basofilosA_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.eosinofilosA_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.monocitosA_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.linfocitosA_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.neutrofilosA_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.leucocitos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.eritrocitos_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.anchoDis_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.chcm_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.hcm_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.vcm_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.hematocrito_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.hemoglobina_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.hematies_tbox)
    Me.hematimetria_gbox.Controls.Add(Me.vpm_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.plaquetas_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.basofilos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.eosinofilos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.monocitos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.linfocitos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.neutrofilos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.basofilosA_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.eosinofilosA_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.monocitosA_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.linfocitosA_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.neutrofilosA_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.leucocitos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.eritrocitos_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.anchoDis_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.chcm_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.hcm_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.vcm_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.hematocrito_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.hemoglobina_lbl)
    Me.hematimetria_gbox.Controls.Add(Me.hematies_lbl)
    Me.hematimetria_gbox.Font = New System.Drawing.Font("MS PGothic", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
    Me.hematimetria_gbox.ForeColor = System.Drawing.Color.DarkRed
    Me.hematimetria_gbox.Location = New System.Drawing.Point(16, 50)
    Me.hematimetria_gbox.Name = "hematimetria_gbox"
    Me.hematimetria_gbox.Size = New System.Drawing.Size(350, 883)
    Me.hematimetria_gbox.TabIndex = 0
    Me.hematimetria_gbox.TabStop = False
    Me.hematimetria_gbox.Text = "HEMATIMETRÍA"
...


¿Donde debo añadir la sentencia que le diga al Form que cargue el GroupBox para yo poder actuar sobre él?
Antes intentaba poner el focus en él con:
1
2
3
4
5
If hematimetria_gbox.ContainsFocus = True Then
 
  hematimetria_gbox.BackColor = Color.BurlyWood
 
End If
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

¿Cómo se puede cargar un GroupBox antes del Load del form?

Publicado por Daniel (3 intervenciones) el 22/03/2021 14:39:05
Al TabIndex del GroupBox ponelo en "0".
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de melqui
Val: 643
Bronce
Ha mantenido su posición en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

¿Cómo se puede cargar un GroupBox antes del Load del form?

Publicado por melqui (242 intervenciones) el 22/03/2021 15:13:35
josé,

creo que no me entendiste
este es el load
1
2
3
4
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
 
 
End Sub

dije fuera de ella quedaria si el el formulario
1
2
3
4
5
6
7
8
9
10
11
12
Public Sub New()
 
    ' Esta chamada é requerida pelo designer.
    InitializeComponent()
 
    ' Adicione qualquer inicialização após a chamada InitializeComponent().
 
End Sub
 
Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
 
End Sub

y dentro del
1
Public Sub New()

apenas colocar group.focus.
al cargar el ira a hacer un foco directamente en el grupo donde deseas. mas voy a facilitar tu rutina.
quieres que el foco sea en el elemento group cierto ?
hay muchas formas de colocar focado. uno de ellos es el TabIndex tal como está en esta imagen. si lo pones cero, talves no está funcionando porque ya existe en otro elemento atrelado para el cero
Screenshot_1


mas yo en mi caso nunca la uso el tabindex, porque ya imaginas en tu formulario tu tienes 20 elementos entre label, textbox, combobox. y revisar a cada un de ellos perderia mucho tiempo. visual studio disponibiliza un recurso que ayuda mucho en mi caso ayuda bastante que es el "orden de tabulaciones" bueno asi está en mi portugues. mas español deve ser diferente, mas lo puedes identificar por el icon que representa.

Screenshot_2

cuando lo activas de va a mostrar todos los tabindex de como ellos estan ordenados, si desejas que tenga secuencia en los elementos, es solo clicar en el elemento que deseas comenza desde 0,1,2,3.. asi te ayuda a colocar el focus q deseas.

si no esta en la herramienta estandar. lo pudes encontrar conforme la imagen.
Screenshot_3

espero que seja de grande ayuda.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil
Val: 229
Ha disminuido 1 puesto en Visual Basic.NET (en relación al último mes)
Gráfica de Visual Basic.NET

¿Cómo se puede cargar un GroupBox antes del Load del form?

Publicado por José Vicente (113 intervenciones) el 23/03/2021 12:22:29
Hola, no funciona.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar