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

Control referencing other control by property

Hi all,

I would like to create something that should be fairly simple I guess,
but I just might be taking a wrong road here or just don't know where
to look for an answer. Please enlighten me!

My wish:
Two controls:
First one (inherits Label) has a property with wich you can select any
of the available Controls type Two on the same form. I would like to
keep a reference to the control(Two) selected so when it changes name,
my property(of ControlOne) will also change. I've been going bakc and
forth, but my solution does not work. The controls will be linked in
designtime, but not runtime. Furthermore, after running a test, my
propertysetting is gone.
My implementation so far:
The typeconverter for the property seems to work as it lists all
ControlTwo types on the same form and lets me select it. I'll leave
that code out for now.
Public Class ControlOne
Inherits Label

Private m_objTwo As ControlTwo

Public Sub New()
Me.BackColor = Color.LightCoral
End Sub

<NotifyParentProperty(True), TypeConverter(GetType(QDataList)),
Bindable(False)> _
Property pControlTwo() As String
Get
Try
If m_objTwo Is Nothing Then
pControlTwo = ""
Me.BackColor = Color.LightCoral
Else
pControlTwo = m_objTwo.Site.Name
End If
Catch ex As Exception
pControlTwo = ""
Me.BackColor = Color.LightCoral
End Try
End Get

Set(ByVal value As String)
Dim objComponent As Component
Try
For Each objComponent In Container.Components
If objComponent.Site.Name.Equals(value) Then
m_objTwo = objComponent
Text = "Linked to " & objComponent.Site.Name
Me.BackColor = Color.Transparent
End If
Next
Catch ex As Exception
Text = "Not linked"
End Try
End Set
End Property

End Class

Any directions will be appreciated, greets,
Marcel

Jun 28 '06 #1
0 778

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

Similar topics

3
by: DC Gringo | last post by:
I have an myPage.aspx with a myPage.ascx user control. The user control is the main header of the page. I have some conditional case code in the user control that I use which depends on a public...
13
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
6
by: Bruce Rusk | last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what may be a slight bug in it. I have a lot of non-Western language (Chinese) text in my RTF field, and such records get...
7
by: Jacky Luk | last post by:
Does anyone know of a downloadable Line ActiveX control which allows me to plot straight lines on a VC++.NET form? Thanks Jack
6
by: martin | last post by:
Hi, I am a web page and a web user control. My web user control is placed in my web page using the following directive <%@ Register TagPrefix="uc1" TagName="Header"...
6
by: Ken Breit | last post by:
I have an ActiveX control that I would like to make available from any form in my application. I figured the best way was to create a reference to it, and then have a module that will create the...
3
by: RSH | last post by:
Hi, I have a situation where I have a page built in .Net 1.1 that I have a PlaceHolder in the Design. From the CodeBehind I am dynamically referencing a user control. This is a snippet from...
5
by: Fernando Chilvarguer | last post by:
I'm sure this has come up before but I could not find any post on it. How can I read a variable or property that has been set on a ASPX page from inside a ASCX control. ASPX code: public...
4
by: Torben Laursen | last post by:
I want to change the label of a component that I have on a masterpage but I cannot get my hands on it I have a mastepage MP2 that has a button called B2 masterpage MP2 uses masterpage MP1 that has...
2
by: =?Utf-8?B?SmFtZXMgUGFnZQ==?= | last post by:
Hi all I have a user control - mycontrol.ascx with various controls within it. mycontrol.ascx is utilised in myPage.aspx I have a class (class1) to carry out various functions, subs etc. How...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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,...
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
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,...
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...

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.