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. C#
  4. I want to display both Old and New Values in Form2.

I want to display both Old and New Values in Form2.

Scheduled Pinned Locked Moved C#
help
3 Posts 3 Posters 22 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.
  • S Offline
    S Offline
    Sonika B S
    wrote on last edited by
    #1

    I have three windows form say form1 ,form2 and pin form.In form1 user have to input some values.There is save button in this page .By clicking on save button Pin form is opened in that we have enter the correct pin and by clicking on submit button form2 get opened.In Form2 the values that user entered in the form1 is displayed in the old values column. And then the user go back to form1 and modify the values and click save button to come to form2. That modified values are displayed in new values column. The problem is that when second time i modify the values in form1 and click save to go to form2,there i am getting old values of form1 but I want both old values and new values

    D OriginalGriffO 2 Replies Last reply
    0
    • S Sonika B S

      I have three windows form say form1 ,form2 and pin form.In form1 user have to input some values.There is save button in this page .By clicking on save button Pin form is opened in that we have enter the correct pin and by clicking on submit button form2 get opened.In Form2 the values that user entered in the form1 is displayed in the old values column. And then the user go back to form1 and modify the values and click save button to come to form2. That modified values are displayed in new values column. The problem is that when second time i modify the values in form1 and click save to go to form2,there i am getting old values of form1 but I want both old values and new values

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

      Well, there's a problem in your secret code that you didn't show. It's not entirely clear what you mean by "old values" and "new values", so I'm just going to say this. It sounds like you're not updating the new values in the form when Form2 returns. It seems you're like ignoring them, or you're using controls to store values instead of a data model, and/or you're binding controls to the wrong properties in your model. In all cases, without seeing the code, it's impossible for anyone to tell you what you're doing wrong.

      Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

      1 Reply Last reply
      0
      • S Sonika B S

        I have three windows form say form1 ,form2 and pin form.In form1 user have to input some values.There is save button in this page .By clicking on save button Pin form is opened in that we have enter the correct pin and by clicking on submit button form2 get opened.In Form2 the values that user entered in the form1 is displayed in the old values column. And then the user go back to form1 and modify the values and click save button to come to form2. That modified values are displayed in new values column. The problem is that when second time i modify the values in form1 and click save to go to form2,there i am getting old values of form1 but I want both old values and new values

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        OK, that's not too bad if you handle it right. Add a property to Form2 to take the value. In the property setter, set the old values column. Then go to Form1 and open the PIN form using ShowDialog - that means that Form1 will be "frozen" until the user closes the PIN form. Now create an instance of Form2 and store it in a class level variable. Handle the Form2.FormClosed event, and clear that variable to null in the handler. Display Forms2 using the Show method. In the Save button handler, check the variable: if it is null, do nothing. Otherwise, use the property to set the new value(s). Sounds complicated, but it's pretty simple when you get your head around it.

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        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