Click here to Skip to main content
15,921,837 members
Home / Discussions / C#
   

C#

 
GeneralRe: Problem with code returning parameter from stored procedure Pin
Christian Graus12-Jul-06 11:36
protectorChristian Graus12-Jul-06 11:36 
GeneralRe: Problem with code returning parameter from stored procedure Pin
leckey12-Jul-06 11:50
leckey12-Jul-06 11:50 
Questionreturn code from console application Pin
Petes197312-Jul-06 9:45
Petes197312-Jul-06 9:45 
AnswerRe: return code from console application Pin
led mike12-Jul-06 9:56
led mike12-Jul-06 9:56 
GeneralRe: return code from console application Pin
Petes197312-Jul-06 10:02
Petes197312-Jul-06 10:02 
GeneralRe: return code from console application Pin
led mike12-Jul-06 10:17
led mike12-Jul-06 10:17 
GeneralRe: return code from console application Pin
Petes197312-Jul-06 10:30
Petes197312-Jul-06 10:30 
QuestionDisplaying Calculation results. [modified] Pin
Skanless12-Jul-06 9:42
Skanless12-Jul-06 9:42 
I am new to C# and have a class project to work on. I am trying to create an Amortization calulator the display the payment results based on the Time period thay have to repay the loan. The calculation part of it is working fine but I can not get it to display the result. Can I please get some help with this? See code Below:


<script runat="server">

protected void Button1_Click(object sender, EventArgs e)
{
Label6.Text = "Final Balance: " +
CalculateBalance(Convert.ToInt32(TextBox1.Text),
(Convert.ToDouble(TextBox2.Text) / 100),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();



}

private string CalculateBalance(int Principal, double Rate, int Years, int Period)
{
double result;
double NumToBeRaised = (1 + Rate / Period);
result=Principal * System.Math.Pow(NumToBeRaised, (Years * Period));
return (result.ToString("C"));
}

private string AmortDisplay(double Principal, double results, int Years, int Period)

{

int AmortTime;
double AmortPayment;
double RemBalance;
string Output;


AmortTime = (Years * Period);
AmortPayment = (results / AmortTime);
RemBalance = -(Principal - AmortPayment);



TextBox4.Text = "Duration\t \tPayment\t \tRemaining Balance \n" + AmortTime + "\t\t" + Convert.ToString(AmortPayment) + "\t\t" + Convert.ToString(RemBalance) + "\n";


}





protected void Button2_Click(object sender, EventArgs e)
{

AmortDisplay(Convert.ToDouble(TextBox1.Text),
Convert.ToDouble(Label6.Text),
Convert.ToInt32(TextBox3.Text),
Convert.ToInt16(DropDownList1.SelectedItem.Value)).ToString();

}

</script>
ext="Principal ($)" Width="165px" BackColor="Transparent" Font-Size="Medium"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Style="position: relative" BackColor="Silver"></asp:TextBox><br />
<br />
<asp:Label ID="Label3" runat="server" Style="position: relative" Text="Rate (%)" Width="165px" BackColor="Transparent" Font-Size="Medium"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Style="position: relative" BackColor="Silver" TabIndex="1"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label4" runat="server" Style="position: relative" Text="Years:" Width="165px" BackColor="Transparent" Font-Size="Medium"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server" Style="position: relative" BackColor="Silver" TabIndex="2"></asp:TextBox><br />
<br />
<asp:Label ID="Label5" runat="server" Style="position: relative" Text="Compound Frequency:" Width="165px" BackColor="Transparent" Font-Size="Medium"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" Style="position: relative" BackColor="Silver" TabIndex="3">
<asp:ListItem Value="1">Annually</asp:ListItem>
<asp:ListItem Value="4">Quarterly</asp:ListItem>
<asp:ListItem Value="12">Monthly</asp:ListItem>
<asp:ListItem Value="365">Daily</asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:DropDownList><br />
<br />
<asp:Button ID="Button1" runat="server" Style="left: 9px; position: relative; top: 10px"
Text="Calculate" Width="207px" OnClick="Button1_Click" BackColor="Silver" TabIndex="4" Font-Size="Medium" /><br />
<br />
<br />
<br />
<asp:Label ID="Label6" runat="server" Style="position: relative" Width="165px"></asp:Label>&nbsp;<br />
<asp:TextBox ID="TextBox4" runat="server" Height="345px" Style="position: relative"
Width="871px"></asp:TextBox>



Greg

The Belizean Dan Dada!!!
AnswerRe: Displaying Calculation results. Pin
Guffa12-Jul-06 12:32
Guffa12-Jul-06 12:32 
QuestionDifference between Thread.Start() and Delegate.BeginInvoke() Pin
zaboboa12-Jul-06 9:40
zaboboa12-Jul-06 9:40 
AnswerRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
Josh Smith12-Jul-06 9:55
Josh Smith12-Jul-06 9:55 
GeneralRe: Difference between Thread.Start() and Delegate.BeginInvoke() [modified] Pin
zaboboa12-Jul-06 10:00
zaboboa12-Jul-06 10:00 
GeneralRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
Josh Smith12-Jul-06 10:12
Josh Smith12-Jul-06 10:12 
GeneralRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
Alexander Wiseman12-Jul-06 13:12
Alexander Wiseman12-Jul-06 13:12 
AnswerRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
Alexander Wiseman12-Jul-06 12:19
Alexander Wiseman12-Jul-06 12:19 
GeneralRe: Difference between Thread.Start() and Delegate.BeginInvoke() Pin
zaboboa13-Jul-06 1:51
zaboboa13-Jul-06 1:51 
QuestionInheritance... Pin
Besinci12-Jul-06 9:31
Besinci12-Jul-06 9:31 
AnswerRe: Inheritance... Pin
BoneSoft12-Jul-06 9:36
BoneSoft12-Jul-06 9:36 
QuestionGraphics class Pin
BoneSoft12-Jul-06 9:30
BoneSoft12-Jul-06 9:30 
AnswerRe: Graphics class Pin
Christian Graus12-Jul-06 9:37
protectorChristian Graus12-Jul-06 9:37 
GeneralRe: Graphics class Pin
BoneSoft12-Jul-06 9:48
BoneSoft12-Jul-06 9:48 
GeneralRe: Graphics class Pin
Josh Smith12-Jul-06 9:50
Josh Smith12-Jul-06 9:50 
GeneralRe: Graphics class Pin
BoneSoft12-Jul-06 9:51
BoneSoft12-Jul-06 9:51 
GeneralRe: Graphics class Pin
alexey N12-Jul-06 21:13
alexey N12-Jul-06 21:13 
QuestionBeep Pin
haytham_mohammad12-Jul-06 8:40
haytham_mohammad12-Jul-06 8:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.