creating a control
Posted
#1
(In Topic #385)
Regular

Code
for i = 0 to 5
With hBtn = New Button(Me) As "BtnTest"
.X = 10 * i
.Y = 10
.W = 10
.H = 10
.Name = "Btn" & i
.text = "+"
End With
next
How can I access or change the properties of a particular button?
This is the only way I have at the moment:-
Code
Dim hControl As Control
For Each hControl In Me.Controls
If hControl.Name = "Btn5" Then hControl.Hide
Next
Any advice would be welcome
Posted
Guru

Try this code (Note I use the 'gb' button on the Forum not the '</>' button to get Gambas code formatting)
Code (gambas)
- .Height = 28
- .Width = 200
- .Text = "Click a button"
- .X = 50 * i
- .Y = 40
- .W = 50
- .H = 50
- .Name = "Btn" & i
- .text = "+"
- hButtons.Add(hBtn)
- hButtons[0].Text = "H"
- hButtons[1].Text = "E"
- hButtons[2].Text = "L"
- hButtons[3].Text = "L"
- hButtons[4].Text = "O"
- hButtons[5].Text = "!"
Posted
Regular

1 guest and 0 members have just viewed this.


