[quote=mgawelek]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.
Can anyone help with this?
took a couple of posts and it is not perfect coding as I had to redo it to only select labels as my first try did not have any other controls so threw an error when I added a button :)
-
Public Class Form1
-
-
Dim ctrl
-
Dim controltype As System.Type ' had to filter for only labels
-
-
-
-
-
-
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
-
For Each ctrl In Me.Controls
-
-
' get type of control
-
-
controltype = ctrl.GetType
-
-
' only change ones that are labels
-
-
If controltype.ToString = "System.Windows.Forms.Label" Then
-
-
ctrl.BorderStyle = BorderStyle.Fixed3D
-
ctrl.Text = "hello"
-
-
End If
-
-
Next
-
-
End Sub
-
End Class
-
-