473,583 Members | 2,875 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1169
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****@discuss ions.microsoft. com> wrote in message
news:CC******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:CC******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> schreef in bericht
news:FD******** *************** ***********@mic rosoft.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****@discuss ions.microsoft. com> wrote in message
news:CC******** *************** ***********@mic rosoft.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
2339
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 HTML behind webpage1. Thanks in advance. Pete
6
1460
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 the properties are blank. So my question is, where is the best place to put the code that handles the form. I was hoping to put it in the...
4
270
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
1936
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 the menu is injected into every page at runtime when the page is requested (i.e., it's not declared in any ASPX). The user control contains a menu...
4
2501
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 I have exposed a public property containing the value of a textbox in a user control..how do I grab this from the calling page? I cant think of the...
8
2256
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 happens. dim filt as string ... build filter string... UserControl.ReportFilter = filt
2
4809
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 required: <%@ Register TagPrefix="UC" TagName="MyUserCtrl" Src="MyUC.ascx" %> Assuming that the ASPX page doesn't use a code-behind, I can access the...
6
11063
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 how those properties are set. I want to be able to do two other things: a) add User control instances to my page, filling in the place of...
1
1538
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 by default to the controls. These properties must be removed from the 'Properties window' of the usercontrol. Also the user must not be able to set...
3
1918
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 been unable to expose the user control class itself. I'm guessing that I need to set up an interface, but I am not sure how to accomplish this. ...
0
7888
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...
0
7811
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...
0
8159
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6571
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...
1
5689
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5366
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...
0
3811
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2317
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
1
1416
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.