Results 1 to 4 of 4

Thread: [2005] Get value From form called by User Control

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    13

    Question [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.

  2. #2
    Lively Member
    Join Date
    Jul 2007
    Posts
    85

    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:
    1. Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    2.         myUserControl.SomeProperty = Textbox1.Text
    3. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Nov 2007
    Posts
    13

    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

    Code:
    Form1.Show()
    When I try in Form1
    Code:
     UserControl. ......
    no properties of the user control.


    Maybe i open the form wrong way
    Last edited by bullzzeye; Jan 12th, 2008 at 01:54 AM.

  4. #4
    Frenzied Member
    Join Date
    Aug 2006
    Posts
    1,051

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width