Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 24-06-2009
Member
 
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.
Reply With Quote
  #2  
Old 24-06-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
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 )
Reply With Quote
  #3  
Old 24-06-2009
Member
 
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
Reply With Quote
  #4  
Old 24-06-2009
Member
 
Join Date: May 2008
Posts: 2,008
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
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "VB.NET Parent Form Reference"
Thread Thread Starter Forum Replies Last Post
Google Chrome is opening in basic HTML form instead of the Standard form Beatrix Technology & Internet 5 25-05-2011 10:21 PM
how to get items in a form to auto-resize with the form using visual basic deansmylie93 Software Development 2 02-05-2011 07:06 AM
What are parent::construct() and parent::destruct() in PHP? warehouse peon Software Development 5 06-03-2010 07:11 AM
Procedure in VB to create form inside another form Jalabala Software Development 3 16-11-2009 02:14 PM
Problem reloading MDI child form in main form. AFFAN Software Development 3 30-01-2009 09:05 PM


All times are GMT +5.5. The time now is 12:33 AM.