I need a solution for a small problem in my project and I'll make it as simple as possible:
At one of the forms in my project, user should be able to add a panel to the form and that form should contain 2 controls ... a label and a (stopwatch or timer).
The problem is after creating the stopwatch dynamically, I can't set a name for the stopwatch. Later in that form when user clicks on the panel stopwatch must start. How can I set the name for created stopwatch? or any other solution if my way is too stupid. Here's what I have :
Dim Panels As Integer = ds.Tables("Pool").Rows.Count For i = 1 To Panels 'set the new panel number Dim NextPanelNumber As Integer = FlowLayoutPanel1.Controls.Count + 1 'controls to be added Dim NextPanel As New PanelControl Dim NextPanelLabel As New LabelControl Dim NextPanelStopwatch As New Stopwatch 'determine properties for new table NextPanel.Width = 200 NextPanel.Height = 114 NextPanelStopwatch.Name = "anything" ' <-- PROBLEM IS HERE 'add controls into new panel NextPanel.Controls.Add(NextPanelLabel)