AllExperts > Experts 
Search      

VB.NET

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More VB.NET Answers
Question Library

Ask a question about VB.NET
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Syed Rizwan Muhammad Rizvi
Expertise
I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.

Experience
Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.

 
   

You are here:  Experts > Computing/Technology > Basic > VB.NET > Working with MDI

Topic: VB.NET



Expert: Syed Rizwan Muhammad Rizvi
Date: 8/5/2008
Subject: Working with MDI

Question
QUESTION: Dear Sir, I am working with vb.net 2008. I have created 3 form of which 1st form is MDI form & other forms are children of it. when the load the MDI_Form the Form2 will be shown I have a button in Form2 when the click the button of Form2 the Form3 will be opened, I have a button1 in Form3 when I Click that button the back color of form1 has to be changed, but there is no any changes in form2.
Pls can u help me inthis matter.

Thanx
Satish M.B

ANSWER: This might be of help:
http://www.startvbdotnet.com/forms/mdi.aspx

---------- FOLLOW-UP ----------

QUESTION: Dear Sir, thanx for suggestion, but my problem didnt got solved. I think u did'nt get my question. I have 3 forms,
in form2 there is button by cliking that the form3 will get opened & Form3 also have an button by clicking that button certain action has to be performed ie, chinging the backcolor or closing of form2. This action perfoms only wwhn I have not declared FORM 2&3 as MDI Children of form1.
When I declares the Form 1&2 as childform of Form1 the button of Form3 does'nt perfom any actions at all.
I have made the Form1 as MDI Form, when I click the menu item of this form the Form2 will geet opened, & when I click the Button of Form2 the Form3 will get opened but when I click the button of Form3 the Form2 has to get closed or its backcolor has to get changed but its not hapenning. Pls can u tell me why its so & help me in this regard.

Thanx
Satish M.B

ANSWER: I have talked to my guiding angels, and my spiritual teachers for this problem, they all failed to provide a solution. They all suggest that unless I am provided with the source code I would have no clue about this problem :).

---------- FOLLOW-UP ----------

QUESTION: Dear Sir, Here is the following code that which u have asked for
I have 3 forms 1st Parent_Form 2nd Child_Form1 & 3rd is Child_form2.

'Here is the code which contains in Parent_Form
Public Class Parent_Form

   Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
       Dim chld_frm1 As New Child_Form1()
       chld_frm1.MdiParent = Me
       chld_frm1.Show()
   End Sub

   Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
       Me.Close()
   End Sub
End Class


'The code which contains in Child_Form1
Public Class Child_Form1

   Private Sub btn_child_form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_child_form1.Click
       Dim chld_frm2 As New Child_Form2()
       chld_frm2.MdiParent = Parent_Form
       chld_frm2.Show()
   End Sub
End Class


'The code which contains in Child_Form2
Public Class Child_Form2

   Private Sub btn_Child_Form2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Child_Form2.Click
       Child_Form1.Close()
   End Sub

   Private Sub change_color_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles change_color.Click
       Child_Form1.BackColor = Color.Black
   End Sub
End Class

'If I clicks the buttons of Child_Form2 there is no any affect or events generates  on Child_form1. Pls can u help me in this regard.

Thanx
Satish M.B

Answer
change this:
Private Sub btn_child_form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_child_form1.Click
      Dim chld_frm2 As New Child_Form2()
      chld_frm2.MdiParent = Parent_Form
      chld_frm2.Show()
  End Sub
End Class

To this:

Private Sub btn_child_form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_child_form1.Click
      Dim chld_frm2 As New Child_Form2()
      chld_frm2.MdiParent = Me.MdiParent
      chld_frm2.Show()
  End Sub
End Class


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.