ActiveX control property

I have built an ActiveX control with a FileName property in which the user assigns a string value specifying the name of a file. I would like for my users to be able to browse for (and select) the file through a dialog box from the VB properties window similar to the way a FileName is selected for the RichTextBox control. How can I do this?
STKeithAsked:
Who is Participating?
 
Erick37Connect With a Mentor Commented:
This article shows how to add a font property, and can be modified to do the same for a filename property.  

"HOWTO: Add a Custom Font Property to a User Control"

http://support.microsoft.com/support/kb/articles/Q197/1/27.ASP
0
 
caraf_gCommented:
Can't be achieved in VB. The best thing you can achieve is to make the property a Friend property and then expose it through a property page.
0
 
STKeithAuthor Commented:
Thanks Erick37. That was just what I was looking for.
0
 
caraf_gCommented:
Glad Erick's suggestion worked for you. In VB it's always best to be flexible and not to insist on doing things one particular way. In this case, using a property page is the way to go, as indeed it says in Erick's article.

Just check my comment: if you make the property a Friend property (instead of a Public one) the user will *only* be able to change the property via the property page. If you make it a public property, the user could still enter rubbish in the normal property window. Which approach you take depends on how critical this is to the control, I suppose.

Good luck

Pino
0
 
STKeithAuthor Commented:
Thanks Pino, I'll give it a try.

Steve
0
All Courses

From novice to tech pro — start learning today.