473,396 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.
Can anyone help with this?
Expand|Select|Wrap|Line Numbers
  1. For Each ctrl As Control In Form.Controls
  2.  ctrl.BorderStyle = BorderStyle.None
  3. Next
  4.  
Apr 2 '08 #1
6 2817
jg007
283 100+
[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 :)

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Dim ctrl
  4.     Dim controltype As System.Type ' had to filter for only labels 
  5.  
  6.  
  7.  
  8.  
  9.  
  10.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  11.         For Each ctrl In Me.Controls
  12.  
  13. ' get type of control
  14.  
  15.             controltype = ctrl.GetType 
  16.  
  17. ' only change ones that are labels
  18.  
  19.             If controltype.ToString = "System.Windows.Forms.Label" Then
  20.  
  21.                 ctrl.BorderStyle = BorderStyle.Fixed3D
  22.                 ctrl.Text = "hello"
  23.  
  24.             End If
  25.  
  26.         Next
  27.  
  28.     End Sub
  29. End Class
  30.  
  31.  
Apr 2 '08 #2
I will give that a try to see it it works and let you know.

This code worked fine fior me, left the hello in as I wanted to confirm it worked :)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Public Class Form1
  3.  
  4.        Dim ctrl As System.Windows.Forms.Label
  5.  
  6.  
  7.  
  8.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  9.  
  10.         For Each ctrl In Me.Controls
  11.  
  12.             ctrl.BorderStyle = BorderStyle.Fixed3D
  13.             ctrl.text = "hello"
  14.  
  15.         Next
  16.  
  17.  
  18.  
  19.  
  20.     End Sub
  21. End Class
  22.  
  23.  
Apr 2 '08 #4
jg007 that will not work for me because I have buttons in the form too.
Apr 2 '08 #5
jg007
283 100+
jg007 that will not work for me because I have buttons in the form too.
LOL!!!, look at the post again!
Apr 2 '08 #6
LOL!!!, look at the post again!

I see sorry they are pretty much the same. Thanks jg007!
Apr 2 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: swb | last post by:
Hi - I have a simple project that manipulates Adobe Illustrator that works fine at home on Windows XP Pro (with admin login), but gives me an error (error message and source code below) at work...
1
by: Buddy | last post by:
Hello, Does anyone know how to stop labels from wrapping text. If the text is to long for the label then I want it to hide the text just like out the TextBox control works. Thanks,
2
by: Giovane Calabrese | last post by:
( aspx + vb ) hi everyone ! I really need make that function work ! im brazilian , and i want to make a multilanguage system , that function above must look at all ASPX take the labels ID and...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
2
by: Dean Slindee | last post by:
It appears that I have two routines that don't play well together! First routine: a form's background is shaded with a gradient color. Second routine: then, the background of all labels on the...
1
by: Rohan | last post by:
Hi There, Is it possible to rotate or resize pictureboxes, labels, textboxes at runtime? And I even wanted to make textbox and label controls Transperent ?
1
by: Lamis | last post by:
i have 2 forms.. one is windows form and I have a lable there that i do want to control from class1. I thought I could send a referense to the label but I don't know how to do that in VB How do I...
6
by: Blkpower | last post by:
Hi to all, I'm writing a windows form application that has a panel with some labels in it. I need to let the user move these labels with drag and drop inside the panel. How can I do it? I now...
3
by: Allen Maki | last post by:
Hi Everybody, I am new to Famework Programming and I need your help. In Visual C++ .NET
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.