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. Vb.Net Forms Issue

Vb.Net Forms Issue

Scheduled Pinned Locked Moved Visual Basic
helpquestioncsharpdatabase
9 Posts 3 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.
  • P Offline
    P Offline
    projectcode1
    wrote on last edited by
    #1

    Hi, I am working on windows application. I have a form1 and when I click on a button in form1, it shows form2. I perform some Db operations in that form and then close it. When I close the form, I want the form1 to get loaded again. Form2 is not an MDI form. How can I implement this? Can anyone please help with this? Thanks!!

    D 1 Reply Last reply
    0
    • P projectcode1

      Hi, I am working on windows application. I have a form1 and when I click on a button in form1, it shows form2. I perform some Db operations in that form and then close it. When I close the form, I want the form1 to get loaded again. Form2 is not an MDI form. How can I implement this? Can anyone please help with this? Thanks!!

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      projectcode1 wrote:

      I want the form1 to get loaded again.

      Based on wht you described, it should still be there. What code did you do to instantiate and Show Form2? What code did you put in to make Form1 vanish? Also, VB6, or VB.NET? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      P 1 Reply Last reply
      0
      • D Dave Kreskowiak

        projectcode1 wrote:

        I want the form1 to get loaded again.

        Based on wht you described, it should still be there. What code did you do to instantiate and Show Form2? What code did you put in to make Form1 vanish? Also, VB6, or VB.NET? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        P Offline
        P Offline
        projectcode1
        wrote on last edited by
        #3

        Thanks for your reply!! It's in VB.Net. You are right the form is still there but I want to refresh the data in the datagrid and combobox in form1 after I made some changes to the Db using form2. I can now load the form using call load() but the combobox or datagrid doesn't show the new value. The Db has the new value. Page is not getting repainted or refreshed!! Any help will be appreciated. Thanks.

        D 1 Reply Last reply
        0
        • P projectcode1

          Thanks for your reply!! It's in VB.Net. You are right the form is still there but I want to refresh the data in the datagrid and combobox in form1 after I made some changes to the Db using form2. I can now load the form using call load() but the combobox or datagrid doesn't show the new value. The Db has the new value. Page is not getting repainted or refreshed!! Any help will be appreciated. Thanks.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          projectcode1 wrote:

          I can now load the form using call load()

          What??? Where did this come from? If Form1 depends on changes being made to the database by Form2, Form2 should be shown as a dialog, where Form1 waits for Form2 to close, then continues on. Something like this:

          Dim newForm As New Form2
          newForm2.ShowDialog() ' This is a blocking call, so Form1 will wait for Form2 to close!
          ' Refresh database objects here...

          RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          T P 2 Replies Last reply
          0
          • D Dave Kreskowiak

            projectcode1 wrote:

            I can now load the form using call load()

            What??? Where did this come from? If Form1 depends on changes being made to the database by Form2, Form2 should be shown as a dialog, where Form1 waits for Form2 to close, then continues on. Something like this:

            Dim newForm As New Form2
            newForm2.ShowDialog() ' This is a blocking call, so Form1 will wait for Form2 to close!
            ' Refresh database objects here...

            RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            T Offline
            T Offline
            Tyrone_whitey
            wrote on last edited by
            #5

            That seems right. Are you trying to perhaps close one form and open another?? Ty

            1 Reply Last reply
            0
            • D Dave Kreskowiak

              projectcode1 wrote:

              I can now load the form using call load()

              What??? Where did this come from? If Form1 depends on changes being made to the database by Form2, Form2 should be shown as a dialog, where Form1 waits for Form2 to close, then continues on. Something like this:

              Dim newForm As New Form2
              newForm2.ShowDialog() ' This is a blocking call, so Form1 will wait for Form2 to close!
              ' Refresh database objects here...

              RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

              P Offline
              P Offline
              projectcode1
              wrote on last edited by
              #6

              HI Again, thanks for your reply. I did the same but how do i refresh the combox and datagrid in form1. The new value are not seen in the form1. Thanks a lot!

              D 1 Reply Last reply
              0
              • P projectcode1

                HI Again, thanks for your reply. I did the same but how do i refresh the combox and datagrid in form1. The new value are not seen in the form1. Thanks a lot!

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                How did you populate them in the first place? Same thing, only run it again after Form2 closes (returns from the ShowDialog call). This should NOT be done from Form2! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                P 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  How did you populate them in the first place? Same thing, only run it again after Form2 closes (returns from the ShowDialog call). This should NOT be done from Form2! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                  P Offline
                  P Offline
                  projectcode1
                  wrote on last edited by
                  #8

                  Thanks! I tried doing that from form2 but didn't work. Then I called it from form1 event where I called the form2.showdialog, I had to add the item in the combobox there. Why not from form2 ???

                  D 1 Reply Last reply
                  0
                  • P projectcode1

                    Thanks! I tried doing that from form2 but didn't work. Then I called it from form1 event where I called the form2.showdialog, I had to add the item in the combobox there. Why not from form2 ???

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    Because Form2 doesn't, and shouldn't, know ANYTHING about the form that launched it. It's just bad practice. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                    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