c# - How to get value from one form to an other? -


i made form deleting/removing products.

now question how value 1 form other can use update amount of products or delete products database?

i'm trying value of tbaantal.text, can use in other form update amount of products.

or should in other way?

public partial class bevestiging : form {      public bevestiging()     {         initializecomponent();          aantal = 0;      }        public int aantal { get; set; }      private void btnok_click(object sender, eventargs e)     {         int aantal;         if (!int.tryparse(tbaantal.text, out aantal))         {             messagebox.show("u kunt alleen numerieke waardes invullen.", "fout");             return;         }       }       private void btncancel_click(object sender, eventargs e)     {         dialogresult = dialogresult.cancel;         close();     }      private void btup_click(object sender, eventargs e)     {         aantal++;         tbaantal.text = aantal.tostring();     }      private void btdown_click(object sender, eventargs e)     {         aantal--;         tbaantal.text = aantal.tostring();     } 

so can use update here:

private void gridgeregistreerd_columnbuttonclick(object sender, columnactioneventargs e)     {         var dialog = new bevestiging();          if (dialogresult.ok != dialog.showdialog()) ;       } 

you've made public property "aantal" on first form right get/set retrieve value on second form use this:

using (bevestiging myform = new bevestiging()) {     dialogresult result = myform.showdialog();      if (result != dialogresult.ok)     {         int returnedvalue = myform.aantal;     } } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -