Results 1 to 4 of 4

Thread: VB.NET Parent Form Reference

  1. #1
    Join Date
    May 2009
    Posts
    24

    VB.NET Parent Form Reference

    I have two forms on my web page which I manage it via vb. I had designed them in vb and now planing to migrate to vb.net. But before that I want to ensure that the migration will not affect the forms. How can I deal with forms when I upgrade the application. The other thing I want to know that what are the ways by which I can get a reference to a parent form. Because there some relation between both the forms.

  2. #2
    Join Date
    Jan 2008
    Posts
    1,521

    Re: VB.NET Parent Form Reference

    Here is a simple solution for your issue of form reference. You want to set up reference for the parent form related with the other one. Whenever vfp is started up a object name _screen is created. The most important custom property of _screen is Active form. Like you have a process called for different forms, so will simply pass a parameter or two. But if the process needs a access properties or method when the function is called then you have to give it reference to the form. See the sample below :

    DO myproc WITH ThisForm

    and in the procedure you need a corresponding parameter

    FUNCTION myProc( toForm )

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: VB.NET Parent Form Reference

    After migration the way dealing with forms will be changed. Instead of loading and showing a form in the older way here you will have to create an instance of the form. After that only you can manipulate the from object. Yo had mentioned that you have two forms. Here Form2 is linked with Form1. When clicked on button in form 1 the second one comes up. I will assume the button is called as TheForm2 button. Now view the sample code here :
    Code:
    Private Sub TheForm2Button_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles TheForm2Button.Click
        Dim F2 As New Form2()
        F2.Show()
    End Sub

  4. #4
    Join Date
    May 2008
    Posts
    2,012

    Re: VB.NET Parent Form Reference

    I will provide you with a basic and simple example to work with forms after upgrade. This one is the easy way. The below codes enables the user to reach to the second form and closing the first one. The below syntax will used for the purpose :
    Code:
    Private Sub SecondFormButton_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles SecondForm.Click
        Dim F2 As New Form2()
        F2.ShowDialog(Me)
    End Sub

Similar Threads

  1. Replies: 5
    Last Post: 25-05-2011, 10:21 PM
  2. Replies: 2
    Last Post: 02-05-2011, 07:06 AM
  3. What are parent::construct() and parent::destruct() in PHP?
    By warehouse peon in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 07:11 AM
  4. Procedure in VB to create form inside another form
    By Jalabala in forum Software Development
    Replies: 3
    Last Post: 16-11-2009, 02:14 PM
  5. Problem reloading MDI child form in main form.
    By AFFAN in forum Software Development
    Replies: 3
    Last Post: 30-01-2009, 09:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,685,731.68432 seconds with 16 queries