Solved

how can i get the .Name property of a referenced control?

Posted on 2000-05-15
25
150 Views
Last Modified: 2013-11-26
If I put a control on a form and then programaticly create another control of the same type then set that 2nd control = to the one on the form I create a reference to the orginal control. But I can not seem to get the .Name property of the orginal control I set the reference to.

Although that doesn't sound like it makes sense because I would have had the name of the control to set the programaticly created one to eqaul it, it is not that simple.

My programaticly created one was set to it through the use of a collection object so I dont actually know the name of the control it was set to. For some reason the .Name property does not show up when I see the list of properties/methods after the "." when typeing its name..


I might add that the control is a custom created user control. When I type the controls name explicitly I see the name property in the list but when I type the  referenced objects name i dont see the .name property in the list.


Case where I see the .Name Property:

   form_Customer.GDBE_Customer.Name

Case when I DONT see the .Name Property:

   dim TempObject as GDBE
   set TempObject = form_Customer.GDBE_Customer

Then If I typed:

   TempObject.(Here I would see all my public methods/properties, but Name does not show up!)

any Ideas?



0
Comment
Question by:BALAJI
  • 11
  • 10
  • 2
  • +2
25 Comments
 
LVL 3

Expert Comment

by:Elmo_
ID: 2812578
BALAJI,

Are you trying to set a temp object equal to that control??  
What type of control are you using on Form_Customer??
What are you actually trying to do??

Elmo
0
 

Expert Comment

by:AZWolf7
ID: 2812601
Is GDBE_Customer explicitly declared as a GDBE control? Can you show us the declarations of the collection and how it is being set?
0
 

Author Comment

by:BALAJI
ID: 2812660
yes GDBE_Customer and TempObject are being explicitly declared as a GDBE control. the collection is the SelectedControls collection of the PropertyPages, but that is besides the point because as you can see in my example above which uses no collections it still does not work.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2812695
i imagine it must be some sort of functionality left out of the user control.  i am not sure what all it entails to code that into a user control, but seeing that regular controls do not suffer from this problem, i would imagine it has something to do with the said control.
0
 
LVL 15

Expert Comment

by:ameba
ID: 2812712
TempObject.Object.Name
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2812768
ameba,
if the .name property is seen under normal conditions when the control is referenced directly, why would the property now all of a sudden be found under its .object property?
0
 
LVL 15

Expert Comment

by:ameba
ID: 2812911
It won't be found - no property will show when you type 'object.', but it will be possible to use the property (I hope :)
0
 
LVL 15

Expert Comment

by:ameba
ID: 2812966
When some property of the user control does not work, adding .Object. usually helps.
That has to do with getting property or method *to work*.

To *see* a property 'Name' of your control, well, you won't see it when you type 'dot' if user control is in your project. You will see only properties *you* provided. The 'Name' property is provided by Unknown4._UserControl library.

When user control is NOT in your project (e.g. it is in separate OCX project), Intellisense will show 'full' set of properties.
0
 

Author Comment

by:BALAJI
ID: 2814354
the .Object.Name does not work either. Is there any other way to return the name property?

I did not add the name property to my user control because it automaticly appeared when I dropped it on a form, do i need to add it for it to work?

And if i need to add it how should I go about doing that?

The only other Thing I can think of is to make a user defined property called Name2 or something like that and make sure that equals the .Name property.. but that is not really the best way so do you have any more ideas?
0
 
LVL 15

Expert Comment

by:ameba
ID: 2814677
What about using separate OCX project for your usercontrol?
0
 

Author Comment

by:BALAJI
ID: 2822059
I figured it out myself, I need to make a custom property that assigns the the value of UserControl.Extender.Name to the property then I can read that user created property from my property page.
0
 

Author Comment

by:BALAJI
ID: 2822060
This question has a deletion request Pending
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 15

Expert Comment

by:ameba
ID: 2871546
This question no longer is pending deletion
0
 
LVL 15

Expert Comment

by:ameba
ID: 2871547
>I figured it out myself, I need to make a custom property ...

Did you figure it yourself? My comment:

"You will see only properties *you* provided."

didn't help you?
0
 

Author Comment

by:BALAJI
ID: 2871621

I didn't care if i could see the .Name property only If i could get the value of the .Name property, I could care less if it shows up in the list, but your suggestion was to use the .Object.Name property which didn't work at all. So the only way i could get this to work the way I needed was to create a user property called ControlName:

Public Property ControlName() as string
    ControlName = usercontrol.name
End Property


And nothing you said mentioned at all that this is how I could get it. You just said I would only see my own properties, and methods in the list, but my question was how can I return the .Name property of a user control.

----Ameba's comment----
>I figured it out myself, I need to
Did you figure it yourself? My comment:

"You will see only properties *you* provided."

didn't help you?

0
 

Author Comment

by:BALAJI
ID: 2871622
This question has a deletion request Pending
0
 
LVL 15

Expert Comment

by:ameba
ID: 2871771
This question no longer is pending deletion
0
 
LVL 15

Expert Comment

by:ameba
ID: 2871772
>your suggestion was to use the .Object.Name property which didn't work at all

No, it didn't. But this is not the only suggestion I made. I was reffering to my other comment.
0
 

Author Comment

by:BALAJI
ID: 2871774
Ameba,

What comment were you reffering to?
0
 
LVL 15

Accepted Solution

by:
ameba earned 50 total points
ID: 2871789
>What comment were you reffering to?
This:
"You will see only properties *you* provided."
 
So, you created/provided the additional property. And this was the solution.
0
 

Author Comment

by:BALAJI
ID: 2871834
All along I knew I could see only the proeprties I created that is why I was askig the question on how to see(have access) the intrinsic ones. Your comment didn't tell me anything I had not known comming into this question. I was looking for a way around creating a custom property for the name.
0
 

Author Comment

by:BALAJI
ID: 2871852
I think you ment to post the below in this question but you posted in another question. I will accept this as an answer to this question. Thank you for the detail.

If you have ALL, UserControl and Project with 5 forms in one, *single* vb project, you cannot work properly/easy, because vb ide is not user friendly for this, as I commented in your other question:

"To *see* a property 'Name' of your control, well, you won't see it when you type 'dot' if user control is in your project. You will see only properties *you* provided. The 'Name' property is provided by Unknown4._UserControl library.

When user control is NOT in your project (e.g. it is in separate OCX project), Intellisense will show 'full' set of properties."
0
 

Author Comment

by:BALAJI
ID: 2871858
Comment accepted as answer
0
 
LVL 15

Expert Comment

by:ameba
ID: 2871868
>I think you ment to post the below in this question

No, it goes with my description of two roles "OCX author" and "Developer". I noticed here that you keep them together - two projects in one vbp.
0
 

Author Comment

by:BALAJI
ID: 2871902
i do that so I can debug my control. At a later time I will compile it and seperate it from my progject
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now