Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to show the total amnt ,which is in one form(billing form) ,in another form(payment form) which is opened as an object.

What I have tried:

i tried using getter and setter method where i stored the value of the total label in a variable in the getter setter class and tried to display it thru anotherr label in the required form(payment form) after converting to string data type. but after running the program it doesnt show the value as required . just "0".

(Billing form)
BillingSystemgettersetter bsgs = new BillingSystemgettersetter();
           bsgs.total = tot;


(Getter setter class)
public double total { get; set; }


(Payment form)
lbltot.Text = Convert.ToString(bsgs.total);
Posted
Updated 20-Jul-20 23:27pm
v2
Comments
Richard MacCutchan 21-Jul-20 5:10am    
Something is wrong in your code. Unfortunately we cannot access your system, or see your screen.
achalake 21-Jul-20 5:22am    
wud u be able to tell me how i shud tackle this from the very beginning to achieve this function?

1 solution

See Transferring information between two forms, Part 1: Parent to Child[^] and the following two tips which explain how to do it.
 
Share this answer
 
Comments
achalake 22-Jul-20 7:30am    
Thank you very much sir, i was struggling unsuccessfully with this yesterday until i tried your solution. It works . Once again thank you very much!!!
Richard MacCutchan 22-Jul-20 7:40am    
That is not my solution, but one by the great and omnipotent @OriginalGriff (blessings upon his house).
achalake 22-Jul-20 8:25am    
Please convey my immense gratitude to him sir.thank you very much
OriginalGriff 22-Jul-20 8:56am    
He did, you're welcome!

By the way: all articles and tips have a forum at the bottom where you can talk directly to the author if you need to.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900