Link to home
Start Free TrialLog in
Avatar of jr_barros_jr
jr_barros_jr

asked on

Open the File Open from Properties

Hi,

I have a PropertyGrid in my form. I have a Image property there, like standard Image property we have in our IDE for forms, PictureBox etc.

I am needing to invoke/open the file(image) browser from my code during runtime. How can I do that?

thank you.
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

if u have the file path, just use Process.Start("YOUR_FILE_PATH").
if u rather open the image with specific applciation, fro example mspaint, try this:
Process.Start("mspaint","YOUR_FILE_PATH").
Avatar of jr_barros_jr
jr_barros_jr

ASKER

I do not think that your solutions apply to me. Perhaps, It is my fault. I will explain better.

I want to provide the user two different options to open an image. One is from 3 dots button from Image property and the second one is from a Button in my form. When the user click in my button, a file dialog is opened. Besides that, when the user click in 3 dots button from Image property another fiel dialog is opened, but this one is not from my code.

To avoid 2 diffrents file dialog, I would like to invoke/call 3 dots button from Image property from my button event code.

How can I do that?
Can you post some code or some screen shots please ? I really can;t figure out what do you need !!
Thanks
I am attaching the the image that I hope could help to understand my problem.
The "red drawings" represents my "Open Image Button" and my source code. the "orange drawings" represents "3 Dots Image button" that I want to invoke/call using code during runtime instead of use "OpenFileDialog".

ExpEx.png
But those are not different dialogs. Its the same dialog box !!! Only different paths ....
Take a close look at upper right corner. What he want is when he clicks the "..." button, a customized open file dialog popups.
The point is which event in propertygrid will be triggered when he clicks the "..."?
Dear deicidedx,

I know how to use a open file dialog (as you can see, my Open button show a open file dialog, please, see attached picture some messages above - red drawings on right hand side).

I want to trig/start the "..." button event by code during runtime.

I do NOT want to learn how to open a file dialog.
I'm not very sure but i think its not possible to overwrite the event triggered when the 3 dots button is clicked. but you can add a custom property to the property grid and handle its events as you like.
hi jr_barros_jr,
you might be interested in looking at this one: http://www.codeproject.com/KB/vb/Propertygrid_Editor.aspx
This question is interesting, I am going to build a solution myself. Hopefully I will be quicker than you. : )
Dear deicidedx,

About "you can add a custom property to the property grid and handle its events as you like" I am already doing that until I will find a solution.

Thank you.
Hi,
Actually this one is helping:
http://dotnetfacts.blogspot.com/2008/05/how-to-take-control-over-collection.html
I am attaching my working code now.
ASKER CERTIFIED SOLUTION
Avatar of magicdlf
magicdlf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Dear magicdlf,

First of all, thank you so much for your answer. It is interesting your approach. Instead of call '...' button you are proposing to '...' call my function.

Do you know how can I call the original "EditValue" function from my code?

How fo set the input parameters? Any clue?

Thank you.
Can you please let me see what you have? To be honest, I don't understand why do you want to call the "EditValue" function.
I would like to use the "..." button dialog box. I would like to avoid to create mine. Thus, I will have always the "most updated" image dialgo box which follows FrameWork and I do NOT need to change my code to reflect that.

Could I explain myself?
Change this to your dialog box didn't help?
private OpenFileDialog ofd = new OpenFileDialog();
Just apply the code, in the EditValue function, you can do anything you want to popup the dialogs. What kind of dialog do you have?
I know that I have apply the code in EditValue function. But I would like to avoid that.

My dialog is Image Browser, but create it is not a problem. The problem is keep all my application update after a new "Image Open Window" is released. I would like to avoid that.
So what do you want? You can also focus to your Image Browser, make a EventHandler to notify it, and retrieve the data back and set for EditValue. I am afraid I can't provide more suggestions unless I can see your Image Browser
Dear magicdlf,

I do appreciate your help and your answer. It's a solution. Do not worry. I am just trying to fit it better in my scenario/applications.

Thank you.