Hi,
I have a Windows Form Control that needs to interact with an object created by the project consuming the control. So I have exposed a Public property which I can set to the name of the object at design time.
eg.
Class MyControl
....
Private ObjectRef As lgeConnection.l geConnection
<RefreshPropert iesAttribute(Re freshProperties .All), _
Description("Na me of Object."), _
Category("Misc" )> _
Public Property ObjectName() As MyObjectType
Get
Return ObjectRef
End Get
Set(ByVal Value As MyObjectType)
ObjectRef = Value
End Set
End Property
...
End Class
Question: Can I get the designer to find an instance of MyObjectType and set ObjectName at design time. There should always be one and only one instance of this class.
TIA
Steve 6 1809
Hello Steve,
Thanks for your post. Currently I am looking for appropriate resource to
help you with this issue.
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Thanks for the update Tim.
And yes it has been a good day!
Enjoy!
Steve
"Tian Min Huang" <ti******@onlin e.microsoft.com > wrote in message
news:Pb******** ******@cpmsftng xa10.phx.gbl... Hello Steve,
Thanks for your post. Currently I am looking for appropriate resource to help you with this issue.
Have a nice day!
Regards,
HuangTM Microsoft Online Partner Support MCSE/MCSD
Get Secure! -- www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Hey Steve
If I have understood your question correctly, the problem is that your
ObjectName property is returning MyObjectType instead of a String which is
what you need
e.g.
<RefreshPropert iesAttribute(Re freshProperties .All),
Description("Na me of Object."),
Category("Misc" )>
Public Property ObjectName() As Strin
Ge
If objectref Is Nothing The
objectref = New lgconnectio
End I
Return objectref.objec tnam
End Ge
Set(ByVal Value As String
objectref.objec tname = Valu
End Se
End Propert
Here's a full implementation sample for anyone interested
Imports System.Componen tMode
Public Class UserControl
Inherits System.Windows. Forms.UserContr o
#Region " Windows Form Designer generated code
Public Sub New(
MyBase.New(
'This call is required by the Windows Form Designer
InitializeCompo nent(
'Add any initialization after the InitializeCompo nent() cal
End Su
'UserControl1 overrides dispose to clean up the component list
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean
If disposing The
If Not (components Is Nothing) The
components.Disp ose(
End I
End I
MyBase.Dispose( disposing
End Su
'Required by the Windows Form Designe
Private components As System.Componen tModel.IContain e
'NOTE: The following procedure is required by the Windows Form Designe
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent(
'UserControl
Me.Name = "UserContro l1
End Su
#End Regio
Private objectref As lgconnectio
<RefreshPropert iesAttribute(Re freshProperties .All),
Description("Na me of Object."),
Category("Misc" )>
Public Property ObjectName() As Strin
Ge
If objectref Is Nothing The
objectref = New lgconnectio
End I
Return objectref.objec tnam
End Ge
Set(ByVal Value As String
objectref.objec tname = Valu
End Se
End Propert
Public Interface myObjectTyp
Property objectname() As Strin
End Interfac
Public Class lgconnectio
Implements myObjectTyp
Private m_objectname As Strin
Public Property objectname() As String Implements myObjectType.ob jectnam
Ge
Return m_objectnam
End Ge
Set(ByVal Value As String
m_objectname = Valu
End Se
End Propert
End Clas
End Clas
HT
Félix Lim
Visual Basic and Visual Basic .NE
This posting is provided "AS IS" with no warranties, and confers no rights
Please reply to newsgroups only.
Hi Felix,
I'm not sure that my description was clear.
My code appears to function and I when I add an object of MyObjectType I can
set the property in the designer but I would like to automate this step.
Similar to the way that adding multiple sqlDataAdapters auotmatically bind
to a single sqlConnection.
Thanks Steve
"Felix Lima [MSFT]" <fe****@online. microsoft.com> wrote in message
news:CD******** *************** ***********@mic rosoft.com... Hey Steve,
If I have understood your question correctly, the problem is that your ObjectName property is returning MyObjectType instead of a String which is what you need.
e.g.:
<RefreshPropert iesAttribute(Re freshProperties .All), _ Description("Na me of Object."), _ Category("Misc" )> _ Public Property ObjectName() As String Get If objectref Is Nothing Then objectref = New lgconnection End If Return objectref.objec tname End Get Set(ByVal Value As String) objectref.objec tname = Value End Set End Property
Here's a full implementation sample for anyone interested:
Imports System.Componen tModel
Public Class UserControl1 Inherits System.Windows. Forms.UserContr ol
#Region " Windows Form Designer generated code "
Public Sub New() MyBase.New()
'This call is required by the Windows Form Designer. InitializeCompo nent()
'Add any initialization after the InitializeCompo nent() call
End Sub
'UserControl1 overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Disp ose() End If End If MyBase.Dispose( disposing) End Sub
'Required by the Windows Form Designer Private components As System.Componen tModel.IContain er
'NOTE: The following procedure is required by the Windows Form
Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent() ' 'UserControl1 ' Me.Name = "UserContro l1"
End Sub
#End Region
Private objectref As lgconnection
<RefreshPropert iesAttribute(Re freshProperties .All), _ Description("Na me of Object."), _ Category("Misc" )> _ Public Property ObjectName() As String Get If objectref Is Nothing Then objectref = New lgconnection End If
Return objectref.objec tname
End Get Set(ByVal Value As String) objectref.objec tname = Value End Set End Property
Public Interface myObjectType Property objectname() As String End Interface
Public Class lgconnection
Implements myObjectType Private m_objectname As String
Public Property objectname() As String Implements
myObjectType.ob jectname Get Return m_objectname End Get Set(ByVal Value As String) m_objectname = Value End Set End Property End Class
End Class
HTH
Félix Lima Visual Basic and Visual Basic .NET
This posting is provided "AS IS" with no warranties, and confers no
rights. Please reply to newsgroups only.
Hey Steve,
I still don't understand what you mean. Can you post your full code (both
the usercontrol and a consuming winform app) and provide some more detail
of what you are trying to accomplish?
Thanks,
Félix Lima
Visual Basic and Visual Basic .NET
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only.
Hey Steve,
I still don't understand what you mean. Can you post your full code (both
the usercontrol and a consuming winform app) and provide some more detail
of what you are trying to accomplish?
Thanks,
Félix Lima
Visual Basic and Visual Basic .NET
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: noone |
last post by:
I like to write my code with optionstrict set to on, except for the late
binding errors I get when there is a reason to change some value in a
control on a postback, like:
Label4.Text = (sender.CommandArgument).tostring
HiddenCreative.Value = sender.CommandArgument
that are in a onclick handler for a webform. Looking at the doc it looks
like the only option with OptionStrict is off or on. Is there a way to
simply have the compleir...
|
by: runningdog |
last post by:
Hi,
I have a Windows Form Control that needs to interact with an object created by the project consuming the control. So I have exposed a Public property which I can set to the name of the object at design time.
eg.
Class MyControl
....
Private ObjectRef As lgeConnection.lgeConnection
<RefreshPropertiesAttribute(RefreshProperties.All), _
|
by: JD Kronicz |
last post by:
Hi .. I have an issue I have been beating my head against
the wall on for some time. I am trying to use late
binding for MS graph so that my end users don't have to
worry about having the right version of the MS Graph type
library. Up until now I have been walking them through
the process of setting the references to include their
version of MS Graph library.
My problem is that I can not seem to get the syntax
correct .. or perhaps...
|
by: PC Datasheet |
last post by:
I have this:
Dim Cbr As Object
Dim Ctl As Object
Set Cbr = Application.Commandbars("CourseCalendarMonth")
Set Ctl =
Application.Commandbars("CourseCalendarMonth").Controls("CalendarMonth")
Is this considered late binding? If not, what needs changed?
Thanks!
|
by: Zlatko Matiæ |
last post by:
I was reading about late binding, but I'm not completely sure what is to be
done in order to adjust code to late binding...
For example, I'm not sure if this is correct:
early binding:
Dim ws As DAO.Workspace
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As DAO.Recordset
| |
by: Mystery Man |
last post by:
We are developing a C# application that has many interfaces to the
Microsoft suite (eg Word, Excel, Outlook, Powerpoint, etc). We need to
support Office 97, 2000, 2002 and any future versions.
Our first cut used early binding and worked fine with Office 2002. We
then ran on a machine that had Office 2000 installed and it all turned
to custard.
There appears to be a number of options to take to support multiple
versions:
|
by: Howard Kaikow |
last post by:
There's a significant problem in automating Excel from VB .NET.
Reminds me of a problem I encountered almost 3 years ago that was caused by
the Norton Auntie Virus Office plug-in.
Can anybody reproduce the behavior described below?
For this example, I am using Excel 2002 and VS .NET 2002 and VB 6.
MSFT KB article 304661 gives a trivial example of early and late binding to
Excel
from VB .NET. Note that there is a variable naming...
|
by: eBob.com |
last post by:
In another thread VJ made me aware of Tag. Fantastic! I've been
wanting this capability for a long time. But it seems that I cannot
use it with Option Strict On. In an event handler I have ...
Private Sub chkbxSelI_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
MsgBox("bingo for number " & sender.Tag.ToString)
End Sub
|
by: Arno R |
last post by:
Hi all,
I need to get at specific (shared) agenda-data from MS outlook 2003.
I need every day to get the scheduled 'appointments' for some rooms to Access.
In Access I will show the time-periods that the rooms are booked for that day.
I know how to code all this in Access.
I can show some testdata for 5 rooms quite nicely on a form.
I never ever needed to use Outlook-to-Access before, so I need a good starting point to get the data.
|
by: ADezii |
last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile time (Early Binding) or run time (Late Binding). When you declare an Object Variable as a specific Data Type, you are using Early Binding so the verification can take place during compile time. When you declare a Variable of the generic Object Data...
|
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...
| |
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
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,...
|
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 launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |