473,796 Members | 2,483 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Labels BorderStyle is not a member of system.windows. forms.control

6 New Member
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.BorderSt yle = BorderStyle.Non e 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 2834
jg007
283 Contributor
[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.BorderSt yle = BorderStyle.Non e 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
mgawelek
6 New Member
Here is how I fixed it

http://www.mgwalk.com/Temp_Topic_Vie...Comments&ID=75
Apr 2 '08 #3
mgawelek
6 New Member
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
mgawelek
6 New Member
jg007 that will not work for me because I have buttons in the form too.
Apr 2 '08 #5
jg007
283 Contributor
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
mgawelek
6 New Member
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
3457
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 with Windows Pro 2000 (user login). I'm a novice, so I'm pulling my hair out trying to figure out why I get "Member not found" still. What I've checked: - Same version of Illustrator on both machines (v10) - Same version of .NET on both machines...
1
7882
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
1482
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 send as a parameter ,... so Please , help me ,.. cause it doest work ! '---------------------------------------------------------- --------------
9
5068
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: ******************************************************************************* <asp:DataGrid visible="False" border=1
2
7589
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 form are made transparent. What results is the label's backcolor appearing as blocks of 'control' colored background. Setting the label's backcolor to color.transparent does not make it transparent (evidently the text is repainted with a...
1
3199
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
1291
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 declare the referens in class2??? I need to change color+text from class2 Public Class Clas1 Inherits System.Windows.Forms.UserControl Friend WithEvents lblStatus As System.Windows.Forms.Label
6
20349
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 how to drag and drop for example the text contained in a textbox, but not the whole control. I read an article called "Fake drag and drop" that works without dragdrop event and it's not so good.
3
1416
by: Allen Maki | last post by:
Hi Everybody, I am new to Famework Programming and I need your help. In Visual C++ .NET
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10173
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4116
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2925
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.