vb.net 2k5 Labels BorderStyle is not a member of system.windows.forms.control

I am doing this in vb.net 2K5 The code below is in a module trying to edit the main form’s label control. The error message is: BorderStyle is not a member of System.Windows.Forms.Control. When it is able to be set in the property window and you can do Label1.BorderStyle = BorderStyle.None in the Form’s Code. The Problem

For Each ctrl As Control In Form.Controls ctrl.BorderStyle = BorderStyle.None Next

The work around

For Each ctrl As Control In Form.Controls      Try           Dim sc As System.Windows.Forms.Label = DirectCast(ctrl, System.Windows.Forms.Label)           sc.BorderStyle = myBorderStyle      Catch           ’Do nothing.      End Try Next



Post a comment for www.mgwalk.com
 
Send your comment to www.mgwalk.com
 
Name:
Email:
Web Site:
Rating:
star blank star blank star blank star blank star blank (move mouse over star to select rating)
Comment:
Anti-spam word: (Required) *