I currently have the following bits of code:

Public Class MainFrm

    Private _storage As New List(Of StopwatchStorage)

    Public TotalParticipants As Integer
    Private participantLbl As Label
    Public participantName As TextBox
    Private participantClock As Label
    Private participantContinuation As New Stopwatch 
    Public ParticipantStop As Button 
    Private participantContinue As Button 
    Private participantTimer As Timer 


    ' The options
    Public numEntrants As Integer = 30 
    Public startingEntrants As Integer = 2 
    Public entryTimer As Integer = 90 
    Public addAuto As Boolean = False 

    Dim counterTimer As Integer 

    Private participantStopwatch As New Stopwatch
    Private matchStopwatch As New Stopwatch

    [... Skip the entire portion of the form since it's not relevant...]
    End Class

    Public Class StopwatchStorage
        Public Property Stopwatch As Stopwatch
        Public Property Continuation As Stopwatch
        Public Property ParticipantName As TextBox
        Public Property Label As Label
        Public Property Timer As Timer
        Public Property Button As Button
        Public Property ContinueBtn As Button
    End Class

I want to add an array to the class `StopwatchStorage` but can't figure out how without some ambiguous warning or error popping up. The Array will contain TimeSpan type elements (essentually an array of Stopwatch.Elapsed values)

How do I declare and add a dynamically sized array to the class. I know that I will have to use the UBound function each time I want to add a new array. That's no problem.

What is the actual error and where are you trying to put the array?

Also, does it do the same with other similar collection types like a List(Of TimeSpan)?

What is the actual error and where are you trying to put the array?

Also, does it do the same with other similar collection types like a List(Of TimeSpan)?

I'm not sure about other collection types.

Here is the error message:

Value of '1-dimmensional array of System.TimeSpan' cannot be converted to 'System.TimeSpan'

Here's what I want to do:

I want to run a set of stopwatches and add the value of the timespans to an array that I will be recursing through to add their total values. (The timespans from the stopwatch are a part of the same collection.)

Anyone mind taking a shot at this?

What I'm talking about is either individual TimeSpans (or Timers) or a collection (like a List(Of TimeSpan) or List(Of Timers))

Dim lstTimeSpan As New List(Of TimeSpan) From {
         New TimeSpan(1, 1, 1),
         New TimeSpan(),
         New TimeSpan()
      }

      lstTimeSpan.Add(New TimeSpan(2, 0, 0)) ' 4th timespan in the collection

      Dim lstTimers As New List(Of Timer) From {
         New Timer(),
         New Timer()
         }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.