473,324 Members | 2,531 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,324 software developers and data experts.

User Control Properties

I have a user control with two boolean properties (AutoFit and AutoSize).
Both can be set at design time but both cannot be True. How can I code this
so that at Design Time, when the user sets one to True, the other is toggled
to False.? I'm new to using Design Time Property Editors so would appreciate
any help.
--
Dennis in Houston
Nov 21 '05 #1
3 1159
Hi

this could help:

don't forget that in your constuctor you'll have to set one of the two
booleans to true

hth Peter

Private blnAutoFit, blnAutoSize As Boolean

Public Property AutoFit() As Boolean
Get
Return blnAutoFit
End Get
Set(ByVal Value As Boolean)
blnAutoFit = Value
blnAutoSize = Not Value
End Set
End Property

Public Property MyAutoSize() As Boolean
Get
Return blnAutoSize
End Get
Set(ByVal Value As Boolean)
blnAutoSize = Value
blnAutoFit = Not Value
End Set
End Property
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
I have a user control with two boolean properties (AutoFit and AutoSize).
Both can be set at design time but both cannot be True. How can I code this so that at Design Time, when the user sets one to True, the other is toggled to False.? I'm new to using Design Time Property Editors so would appreciate any help.
--
Dennis in Houston

Nov 21 '05 #2
Yes this works when the application is run but at Design time, it doesn'
reset one to False when both are set to true in the Properties Window. I am
trying to get them to change the design time property window such that if one
is set to True and the use sets the other to True, the first one changes to
False.

"Peter Proost" wrote:
Hi

this could help:

don't forget that in your constuctor you'll have to set one of the two
booleans to true

hth Peter

Private blnAutoFit, blnAutoSize As Boolean

Public Property AutoFit() As Boolean
Get
Return blnAutoFit
End Get
Set(ByVal Value As Boolean)
blnAutoFit = Value
blnAutoSize = Not Value
End Set
End Property

Public Property MyAutoSize() As Boolean
Get
Return blnAutoSize
End Get
Set(ByVal Value As Boolean)
blnAutoSize = Value
blnAutoFit = Not Value
End Set
End Property
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
I have a user control with two boolean properties (AutoFit and AutoSize).
Both can be set at design time but both cannot be True. How can I code

this
so that at Design Time, when the user sets one to True, the other is

toggled
to False.? I'm new to using Design Time Property Editors so would

appreciate
any help.
--
Dennis in Houston


Nov 21 '05 #3
Hi Dennis,

with me that does work even at design time, have you tested it?

Greetz Peter

"Dennis" <De****@discussions.microsoft.com> schreef in bericht
news:FD**********************************@microsof t.com...
Yes this works when the application is run but at Design time, it doesn'
reset one to False when both are set to true in the Properties Window. I am trying to get them to change the design time property window such that if one is set to True and the use sets the other to True, the first one changes to False.

"Peter Proost" wrote:
Hi

this could help:

don't forget that in your constuctor you'll have to set one of the two
booleans to true

hth Peter

Private blnAutoFit, blnAutoSize As Boolean

Public Property AutoFit() As Boolean
Get
Return blnAutoFit
End Get
Set(ByVal Value As Boolean)
blnAutoFit = Value
blnAutoSize = Not Value
End Set
End Property

Public Property MyAutoSize() As Boolean
Get
Return blnAutoSize
End Get
Set(ByVal Value As Boolean)
blnAutoSize = Value
blnAutoFit = Not Value
End Set
End Property
"Dennis" <De****@discussions.microsoft.com> wrote in message
news:CC**********************************@microsof t.com...
I have a user control with two boolean properties (AutoFit and AutoSize). Both can be set at design time but both cannot be True. How can I code

this
so that at Design Time, when the user sets one to True, the other is

toggled
to False.? I'm new to using Design Time Property Editors so would

appreciate
any help.
--
Dennis in Houston


Nov 21 '05 #4

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

Similar topics

6
by: trinitypete | last post by:
I have a user control that is basically a login dialogue. If I add the user control to webpage1, can I access the properties directly from C# codebehind, or do I have to access the properties from...
6
by: Andrea Williams | last post by:
When I step through my code, the ASPX Page_Load happens before the Page_Load in the User Control. This means that the property values are not set to their defaults yet in the User Control and all...
4
by: Mark Goldin | last post by:
I'd like to create a user control (Label and Text box) and modify every instance of that control when I add it to a web page. How can I do that?
7
by: Smithers | last post by:
I have a non trivial ASP.NET Web application that implements its navigation system via a user control (menu.ascx) placed on every page. It is important to note that the user control that hosts...
4
by: louise raisbeck | last post by:
Resending this as own topic as didnt get answer from original. Would be grateful for a response from anyone that knows. Thanks. Hi there, I found your post really helpful..but i wondered if, once...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
1
by: abyclassic | last post by:
Dear All, I am making a Windows Control Library(user control) using VS.NET & C#.NET. Now, i am facing 3 problems: 1.In this control, i wants to remove some of the properties which are available...
3
by: Fred Chateau | last post by:
I am trying to access a user control class, for a user control that is loaded dynamically, from the containing page. I have been able to access Web controls in the user control, but so far I have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.