Pasvorto
Jul 25th, 2007, 09:51 AM
Continuing with my project:
I have this code:
DialogResult result6;
Boolean result7;
result6 = MessageBox.Show("Do you want to do an amortization schedule?", "TVAL", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result6 = DialogResult.Yes)
result7 = true;
else
result7 = false;
if (result7 = true)
{
txtLoanAmount.Text = PVal.ToString("N2");
txtTerm.Text = TotPmts.ToString("N2");
txtRate.Text = APR.ToString("N5");
txtPayment.Text = Payment.ToString("N2");
MessageBox.Show("Fill in dates, select the base, and press [Compute Amortization Schedule] button", "TVAL", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Refresh();
}
I am getting this error (on the result6 = Dialogresult.Yes)
Error 1 Cannot implicitly convert type 'System.Windows.Forms.DialogResult' to 'bool' I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 1257 17 TVAL
I am getting this error on the result7 = true line:
Warning 2 Assignment in conditional expression is always constant; did you mean to use == instead of = ? I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 1262 17 TVAL
The VB6 code was much easier (I am probably doing this wrong):
amort = MsgBox("Your payment will be $" & Format(Payment, Fmt) & " per month." & vbCrLf & vbCrLf & "Do you want to do an amortization schedule?", vbYesNo)
If amort = vbYes Then
txtLoanAmount.Text = PVal
txtTerm.Text = TotPmts
txtRate.Text = APR * 100
txtPayment.Text = Format(Payment, Fmt)
MainMenu.Refresh
End If
I have this code:
DialogResult result6;
Boolean result7;
result6 = MessageBox.Show("Do you want to do an amortization schedule?", "TVAL", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result6 = DialogResult.Yes)
result7 = true;
else
result7 = false;
if (result7 = true)
{
txtLoanAmount.Text = PVal.ToString("N2");
txtTerm.Text = TotPmts.ToString("N2");
txtRate.Text = APR.ToString("N5");
txtPayment.Text = Payment.ToString("N2");
MessageBox.Show("Fill in dates, select the base, and press [Compute Amortization Schedule] button", "TVAL", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Refresh();
}
I am getting this error (on the result6 = Dialogresult.Yes)
Error 1 Cannot implicitly convert type 'System.Windows.Forms.DialogResult' to 'bool' I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 1257 17 TVAL
I am getting this error on the result7 = true line:
Warning 2 Assignment in conditional expression is always constant; did you mean to use == instead of = ? I:\VB NET Source Code\C#\TVAL\TVAL\TVAL\Form1.cs 1262 17 TVAL
The VB6 code was much easier (I am probably doing this wrong):
amort = MsgBox("Your payment will be $" & Format(Payment, Fmt) & " per month." & vbCrLf & vbCrLf & "Do you want to do an amortization schedule?", vbYesNo)
If amort = vbYes Then
txtLoanAmount.Text = PVal
txtTerm.Text = TotPmts
txtRate.Text = APR * 100
txtPayment.Text = Format(Payment, Fmt)
MainMenu.Refresh
End If