I have user control that includes OpenFileDialog
and PictureBox
. I use it in editable forms where the user is allowed to select and save image along with the other info. The problem that I met is that I need to set openFileDialog.Filter
and this Filter is actually the value of one my TextBox
which is named txtCode
.
Now I pass the txtCode.Text
on the Form_load
event but this is not good enough I need to get the value form the TextBox
when the user tries to open the File Dialog
. Because I use it as an User Control
:
And thus I can't catch the button click event. In fact I can only handle the user control click event, which is fired when I click anywhere outside the File Browse
button and the PictureBox
which ruins my workaround plan to handle the event and check if the sender is a Button
.
How can I pass the txtCode.Text
value when the OpenFileDialog
is opened or at least at a very close moment so I can work with the most current value?