473,408 Members | 1,775 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,408 software developers and data experts.

Setting autosize to false

In Visual Studio 2005, using Visual Basic, Is there a way to set the
autosize property [such as in a label control] to false as a standard, and
change it to true as needed?

Or does it always start out as true when a label [or other such control] is
brought in to a form?
This is probably a very basic question, but I appreciate any help anyone can
offer.

Thanks
Matt
Jun 3 '06 #1
1 4192
Matt,
The control itself (the label in this case) controls what the value defaults
to.

The only way I know of to change the default would be to inherit from Label,
creating a derived label that has the new default. Then using the derived
Label instead.

Something like:

Public Class Label
Inherits System.Windows.Forms.Label

Public Sub New()
AutoSize = False
End Sub

<System.ComponentModel.DefaultValue(False)> _
Public Overrides Property AutoSize() As Boolean
Get
Return MyBase.AutoSize
End Get
Set(ByVal value As Boolean)
MyBase.AutoSize = value
End Set
End Property

End Class

The System.ComponentModel.DefaultValueAttribute above, is suppose to tell
the forms designer that the property defaults to False and not True, so the
generated code doesn't include the value...

Unfortunately it appears that the above doesn't want to work in VS 2005
(.NET 2.0), I'll need to try it in VS 2003 this evening, as I'm sure I used
the above in VS 2002 & VS 2003 (.NET 1.x)

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"matthewtech" <ni**************@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
| In Visual Studio 2005, using Visual Basic, Is there a way to set the
| autosize property [such as in a label control] to false as a standard, and
| change it to true as needed?
|
| Or does it always start out as true when a label [or other such control]
is
| brought in to a form?
|
|
| This is probably a very basic question, but I appreciate any help anyone
can
| offer.
|
| Thanks
| Matt
|
|
Jun 9 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Weber Samuel | last post by:
Hi NG i try to catch the Application.Idle Event: --> Application.Idle += new EventHandler(OnIdle); Here's my problem: If i put a Label on my Form and set the Property AutoSize = true then...
0
by: Bob | last post by:
I attached the properties list of the column in a datagridview. The datagridview is bound. Note that the cell visible property is set to false and while looking at the datagridview in the VS IDE...
0
by: OpticTygre | last post by:
How can you autosize a dynamically generated textbox on a form in VS2005 since there is no longer a TextBox.Autosize property? Everything I've read says that it should autosize automatically, but...
8
by: Jordi Rico | last post by:
Hi, I've made the next inherited class in Visual Studio 2005: Public Class LabelEx Inherits System.Windows.Forms.Label Sub New() MyBase.New() Me.ForeColor = Color.Black Me.AutoSize = False...
2
by: =?Utf-8?B?Qm9i?= | last post by:
In VB.Net 2003 and previous versions new labels were created with AutoSize=False. In VB.Net 2005, new labels are created with AutoSize=True. Why was it changed? Is there somewhere in VB.Net 2005...
0
by: Nathan Laff | last post by:
I have a panel set to autosize. Inside it I have a custom label, which changes the height (using measure string) based on the length of the string. (i.e. the label autosizes vertically) this label...
0
by: Ryou kaihou | last post by:
Hello All, As we known, in Visual Stdio 2003 or 2005, the property of Autosize is set to True by defaut, how can I customize this and set property of Autosize to False? Any ideas? Thanks
5
by: BillE | last post by:
I am using VB.NET, VS 2005 Add a windows form and in design view: Add a Radiobutton to the windows form Set AutoSize = True for the radiobutton Set the MaximumSize width to 90 for the...
0
by: SteveL | last post by:
Hi, I'm trying to change the default height of Textboxes in a form of my Mobile Application, without resorting to making them MultiLine, which turns off the Passwordchar substitution). Research...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...

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.