ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to manipulate controls added at run-time (https://www.excelbanter.com/excel-worksheet-functions/65511-how-manipulate-controls-added-run-time.html)

thomasdavisz

How to manipulate controls added at run-time
 
The following code adds 5 spinbuttons next to 5 labels into a frame.
How can I make each spinbox control ( +1 and -1) the number displayed
in the label next to it?

For x = 0 To 5

Set LControl = Frame1.Controls.Add("Forms.label.1")
With LControl
..Caption = 100
..Top = 10 + 30 * x
..Left = 100
..Height = 11
..Width = 15
End With

Set SBControl = Frame1.Controls.Add("Forms.spinbutton.1")
With SBControl
..Top = 6 + 30 * x
..Left = 115
..Height = 18
..Width = 12
End With
Next


Thanx,

Thomas



All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com