473,756 Members | 4,640 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

override BackColor

HI
I created a user control and place some control on it.
I need when I change BackColor of user control,Back Color of other controls
also change..
I used foloowing code:
public override Color BackColor
{
get{return this.BackColor; }
set{
this.BackColor= value;
this.button1.Ba ckColor=value;
}
}
but this code cause an exception of type StackOverFlow..
?????
Nov 17 '05 #1
2 8106


perspolis wrote:
HI
I created a user control and place some control on it.
I need when I change BackColor of user control,Back Color of other controls
also change..
I used foloowing code:
public override Color BackColor
{
get{return this.BackColor; }
set{
this.BackColor= value;
this.button1.Ba ckColor=value;
}
}
but this code cause an exception of type StackOverFlow..
?????


Hi,

Its simple: you should use base.BackColor = value not this.BackColor =
value...
When calling this.BackColor = value, you are calling yourself again...

Eyal.

Nov 17 '05 #2


perspolis wrote:
HI
I created a user control and place some control on it.
I need when I change BackColor of user control,Back Color of other controls
also change..
I used foloowing code:
public override Color BackColor
{
get{return this.BackColor; }
set{
this.BackColor= value;
this.button1.Ba ckColor=value;
}
}
but this code cause an exception of type StackOverFlow..
?????


In order to avoid StackOverflow:

public override Color BackColor
{
get
{
return base.BackColor;
}
set
{
base.BackColor = value;
this.button1.Ba ckColor=value;
}
}

Eyal.

Nov 17 '05 #3

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

Similar topics

2
2348
by: Tom | last post by:
I am trying to override the backcolor in the tool bar but I don't know how to go about it. ms-help://MS.VSCC.2003/MS.MSDNQTR.2003APR.1033/cpref/html/frlrfSystemWindows FormsToolBarClassBackColorTopic.htm here it is I need to override with public override Color BackColor {get; set;} how can I do this ?
6
3440
by: LU | last post by:
A)I build a datagrid based on a calendar date selection. B)When user clicks a button column on the datagrid I want to highlight this row. I use the code below to highlight the row. ***** CODE TO HIGHLIGHT ROW Sub Datagrid_ItemCommand(ByVal s As Object, ByVal e As DataGridCommandEventArgs) If e.CommandName = "ViewUnitRequest" Then e.Item.BackColor = System.Drawing.Color.LightGray
4
2900
by: TJS | last post by:
How can I override the default values, of a class constructor , from an ASP.net page ? Public Sub New( ) HeaderStyle.BackColor = ColorTranslator.FromHtml("#5C85AD") HeaderStyle.ForeColor = Color.White HeaderStyle.Font.Bold = True End Sub
1
4107
by: Firewalker | last post by:
I am attempting to change the backColor property on the previously instantiated buttons FROM a listbox_doubleClick event. I thought it would be something like this: If Me.Controls.Item(iSeatNumber).BackColor.Equals(Color.White) Then Me.Controls.Item(iSeatNumber).BackColor.Equals(Color.CornflowerBlue) 'End If
4
9371
by: ray well | last post by:
in my app i need to make a RichTextbox control transparent. i need it to be a like a pane of glass lying on a sheet of paper, where u can see everything on the sheet of paper not covered by text written on the glass pane. i need to be able to see the control or form that is underneath the RichTextbox, and at the same time to be able to write and erase text to the RichTextbox. i'm assuming that it is the backcolor that hides what is...
3
2429
by: senfo | last post by:
I developed a Windows control in VS 2005 that inherits from the PictureBox Control that adds the ability to select images in a Windows application. It is, however, experiencing a strange issue that I can't explain. One of the desired affects was to provide the ability to change the background color on images that were selected, as well as setting the background color back to its original color after the image had been deselected. To...
0
1267
by: Wolfgrin | last post by:
Hi, I have set up a report In Access 2003 where there are 2 check boxes I refer to to change the color of the Date of that record. That part is working. I also need to Change the color of the date feild when the date in the field is 3 days or more older. I am currently using the following code. Any Suggestions? Thanks In Advance, Ray
4
7906
by: Rob | last post by:
This should be simple..... The default BackColor of a button (if you look at its property) is "Control" its a gray color, but apparently not a color. During a process I set the BackColor of a button to another color by using.... Me.Button.BackColor = Color.Yellow
6
2904
by: Dmitry Duginov | last post by:
Hi, I have the following label markup (label is inside FormView): <asp:Label ID="lblIndicatorReady" runat="server" Text="RE" ToolTip="Ready" BackColor='<%# Eval("Ready").ToString()=="True"?System.Drawing.Color.FromName("#FFFF80"):System.Drawing.Color.White %>' Enabled='<%# Eval("Ready") %>'
0
9456
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
10040
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
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
9846
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
9713
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5142
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
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
2666
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.