Visual Basic Programming Code Examples
Visual Basic > Forms Code Examples
How to resize a form on runtime
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
How to resize a form on runtime
>Could some kind souls provide some example code to perform a resize of
>a form whenever a checkbox is clicked?
on the fly:
make a new project; a new form; a checkbox and a label
put the code in the appropiate places:
Private sub Form_Resize()
Check1.Move 20, 20
Label1.Move 20, Check1.Height + 150
End Sub
Private sub Check1_Click()
If Check1.Value = 1 Then
Form5.Height = 600 + Check1.Height + Label1.Height
Else
Form5.Height = 600 + Check1.Height
end If
End Sub
Private sub Form_Load()
Check1.Caption = "Show me more"
Label1.Caption = "thank you"
Form5.Height = 600 + Check1.Height
End Sub
Return