[2005] Get value From form called by User Control
Hi,
I have a User Control (with user properties ) and form in one project. From a button on the User Control I open the form. I want when i close the form (with the red X on right top of the form) to get a value from the form (from a textbox for example, filled by user) and send it to the property of the user control.
(I make it work but with custom button on form , timers and flags, and i don't think that's the way. And i need to use the standard close button ) Any help is welcome. Thanks in advance.
Re: [2005] Get value From form called by User Control
Quote:
Originally Posted by bullzzeye
Hi,
I have a User Control (with user properties ) and form in one project. From a button on the User Control I open the form. I want when i close the form (with the red X on right top of the form) to get a value from the form (from a textbox for example, filled by user) and send it to the property of the user control.
(I make it work but with custom button on form , timers and flags, and i don't think that's the way. And i need to use the standard close button ) Any help is welcome. Thanks in advance.
You can use the FormClosing event of your form.
vb.net Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
myUserControl.SomeProperty = Textbox1.Text
End Sub
Re: [2005] Get value From form called by User Control
:( This doesn't work for me. I can't get access to user control properties.
From User Control I open the form with
When I try in Form1
Code:
UserControl. ......
no properties of the user control.
Maybe i open the form wrong way :(
Re: [2005] Get value From form called by User Control
http://www.windowsitlibrary.com/Content/1085/09/3.html
The navigation numbers are at the bottom of the page. Read the whole article.