Well it is apparent i am new to c# cause i am having a problem calling a GetPaymentAmount into my GUI.
This is my interface:
namespace Invoice
{
public interface IPaytable
{
decimal GetPaymentAmount();
}
}
This is my method
public decimal GetPaymentAmount()
{
return priceper * quantity;
}
and i am completely lost as how to make it to where i can display the information from the getpaymentamount into my Results textbox as such:
restxtbx.Text += "Total for this transaction is :$" + WHAT GOES HERE? ;
Loading
StevenPosted Feb 22, 2008, 2:54 PM
Thanks alot for your help
AlanPosted Feb 22, 2008, 4:52 AM
This is what you need:
restxtbx.Text += "Total for this transaction is :$" + GetPaymentAmount().ToString();
GetPaymentAmount() produces a decimal result which you then have to convert to a string to be able to add it to the first part of the line. The whole string is then added to what's already in the TextBox because of the += operator.