Link to home
Start Free TrialLog in
Avatar of jellydeal
jellydeal

asked on

VB - PANEL class error - No default Property

Hi,

I am trying yo create a series if panels, the problem is Im getting this error :

'Error 1 Class 'System.Windows.Forms.Panel' cannot be indexed because it has no default property.      

If I move the DIM statement to within the routine the error is cured.
But then calling other routines I get the error again.
Do I need to declare it in a GLOBAL way? .. somehow?

Thanks for your time,
Kindest regards
Barry
Dim panel_day(41) As Panel
Dim month_panel(13) As Panel
Dim lab_day(41) As Label
 
    Do Until month_count > 12
            'BUILD MONTH PANEL
            month_panel(month_count) = New Panel
            month_panel(month_count).BorderStyle = BorderStyle.FixedSingle
            month_panel(month_count).BackColor = Color.Yellow
            month_panel(month_count).Width = 600
            month_panel(month_count).Height = 50
            month_panel(month_count).Location = New Point(10, (month_count * 49) - 39)
            Me.Controls.Add(month_panel(month_count)) 
            'LINE ABOVE GENERATES THIS ERROR
             'Error 1 Class 'System.Windows.Forms.Panel' cannot be indexed because it has no default property.	
 
            '/ MONTH PANEL
 
            month_count = month_count + 1
     Loop

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jellydeal
jellydeal

ASKER

Fantastic!

It worked a treat!
Thanks for yout time!