Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How To Make New Form?

How To Make New Form?

Scheduled Pinned Locked Moved Visual Basic
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mogtabam
    wrote on last edited by
    #1

    Hi All I Create A form Named ChildForm. In Main form I write This Codes

    Dim ChFrm As New ChildForm
    ChFrm.Show

    But I need to access the all form ( random) from Main Form. But I Can't Access This Forms. Please Help Me. Tanks. Mogtabam

    T N M 3 Replies Last reply
    0
    • M Mogtabam

      Hi All I Create A form Named ChildForm. In Main form I write This Codes

      Dim ChFrm As New ChildForm
      ChFrm.Show

      But I need to access the all form ( random) from Main Form. But I Can't Access This Forms. Please Help Me. Tanks. Mogtabam

      T Offline
      T Offline
      Tirthadip
      wrote on last edited by
      #2

      create an MDI Form as your main form. make all other form's IsMDIChild property to true. now you can access all the form from your main form.

      Live life to the fullest

      M 1 Reply Last reply
      0
      • M Mogtabam

        Hi All I Create A form Named ChildForm. In Main form I write This Codes

        Dim ChFrm As New ChildForm
        ChFrm.Show

        But I need to access the all form ( random) from Main Form. But I Can't Access This Forms. Please Help Me. Tanks. Mogtabam

        N Offline
        N Offline
        Navneet Hegde
        wrote on last edited by
        #3

        Do you want the collection of forms like form1, form2 form3 then or you want particular form with refernce to the parent.

        Develop2Program & Program2Develop

        1 Reply Last reply
        0
        • T Tirthadip

          create an MDI Form as your main form. make all other form's IsMDIChild property to true. now you can access all the form from your main form.

          Live life to the fullest

          M Offline
          M Offline
          Mogtabam
          wrote on last edited by
          #4

          Hi And Tanks For Your Replys. But My Problem Not Solved Yet. Because I Want To Access then form and its Components (for example A textbox). I Need To Change It From Main Form. if i have 1 form This is Ok. But I have several form With One Name; For Example Can You Write For Me A Code That Change The TextBox In First MdiChild & Put Another Text In Another MdiChilform? Example: ChForm:My Child Form Have a textbox MainForm: My Main Form have a button Named But In Main form:

          sub But_click()
          dim Cf as new ChForm
          Cf.show
          end sub

          After Tow Or More Click On But I Need To Access TextBox In the ChildForm. Can You Help Me? Tanks. Mogtabam

          R 1 Reply Last reply
          0
          • M Mogtabam

            Hi And Tanks For Your Replys. But My Problem Not Solved Yet. Because I Want To Access then form and its Components (for example A textbox). I Need To Change It From Main Form. if i have 1 form This is Ok. But I have several form With One Name; For Example Can You Write For Me A Code That Change The TextBox In First MdiChild & Put Another Text In Another MdiChilform? Example: ChForm:My Child Form Have a textbox MainForm: My Main Form have a button Named But In Main form:

            sub But_click()
            dim Cf as new ChForm
            Cf.show
            end sub

            After Tow Or More Click On But I Need To Access TextBox In the ChildForm. Can You Help Me? Tanks. Mogtabam

            R Offline
            R Offline
            Ray Cassick
            wrote on last edited by
            #5

            Declare the form outside the method (in the global area of the main form, and then create the new form in the button handler. The then the new form object will be available globally within the main form:

            Public Class MainForm As Form

            Public Cf as ChForm

            sub But_click()
            Cf = new ChForm
            Cf.show

            end sub

            End Class

            However, keep in mind that what you want to do (directly access a control on one form from another) is really bad practice. You should be building properties on the other forms and using them to access the data provided in controls on the form as shown bellow:

            Public Class MainForm As Form

            Public Cf as ChForm
            Private mNameData As String

            sub But_click()
            Cf = new ChForm
            Cf.show

            mNameData - Cf.NameData()
            

            end sub

            End Class

            Public Class ChForm As Form

            Public Property NameData() As String
            Get
            Return txtName.Text

            End Get
            
            Set (value as String)
              txtName.Text = value
            
            End Set
            

            End Property

            End Class

            This keeps things much cleaner and more modular.


            My Blog[^]
            FFRF[^]


            1 Reply Last reply
            0
            • M Mogtabam

              Hi All I Create A form Named ChildForm. In Main form I write This Codes

              Dim ChFrm As New ChildForm
              ChFrm.Show

              But I need to access the all form ( random) from Main Form. But I Can't Access This Forms. Please Help Me. Tanks. Mogtabam

              M Offline
              M Offline
              manni_n
              wrote on last edited by
              #6

              first of all u want to make an MDI parent and child form and u want to access it thru parent form... first of all make form 1 as parent b making its property as is MDI container as true.. nw put a pic box (optional) and put a button on it.. add a form make its property as is MDI child as true.. i hope u knw this much nw in button code.. Dim NewMDIChild As New Form2 'Set the Parent Form of the Child window. NewMDIChild.MdiParent = Me 'Display the new form. NewMDIChild.Show() .. after this i am not getting yr query.. if u have any further query lemme know..

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups