Imports System.Windows.Forms
Imports System.Convert
Imports Microsoft.VisualBasic.Financial
Public Class Chapter7
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim result As DialogResult
result = MessageBox.Show("Do you really want to quit", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
End Sub
Private Sub btnCreateAccount_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCreateAccount.Click
DataGridView1.Columns.Add("Column1", "Loan Amount")
DataGridView1.Columns.Add("Column2", "Annual Interest Rate")
DataGridView1.Columns.Add("Column3", "Term in Years")
DataGridView1.Columns.Add("Column4", "Result Cell")
btnCreateAccount.Enabled = False
btnDeleteAccount.Enabled = True
btnAddAccount.Enabled = True
btnCalculate.Enabled = True
End Sub
Private Sub btnAddRow_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddAccount.Click
DataGridView1.Rows.Add()
End Sub
Private Sub btnDeleteRow_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDeleteAccount.Click
DataGridView1.Rows.RemoveAt(0)
End Sub
Private Sub Chapter7_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
btnDeleteAccount.Enabled = False
btnAddAccount.Enabled = False
btnCalculate.Enabled = False
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Dim InterestRate As Double
Dim Payments As Integer
Dim LoanAmountP As Double
Dim LoanAmountC As Double
Dim LoanAmountCell As DataGridViewCell 'reference cell
Dim InterestCell As DataGridViewCell 'reference cell
Dim TermCell As DataGridViewCell 'reference cell
Dim ResultCell As DataGridViewCell 'reference cell
Dim MiddleMan As String
LoanAmountCell = DataGridView1.Rows(0).Cells(0)
MiddleMan = LoanAmountCell.ToString
LoanAmountP = ToDouble(MiddleMan) ' converts the string i just
got from the datagridview cell into a double
InterestCell = DataGridView1.Rows(1).Cells(1)
TermCell = DataGridView1.Rows(2).Cells(2)
InterestRate = (ToDouble(InterestCell.ToString) * 0.1) / 12
Payments = CInt(TermCell.ToString) * 12
'LoanAmountP = (LoanAmountP * InterestRate * Payments) -
LoanAmountP
ResultCell = Pmt(InterestRate, Payments, LoanAmountP)
End Sub
End Class
My pmt is having trouble taking the loanAmountP variable, i was
wondering if anyway has any hints on what the problem might be. 3 3932
You need to post the code for the pmt function.
I'd check and make sure the variable types match.
When you say it's having trouble, what specifically
is it doing, or not doing?
Robin S.
-----------------
"GrispernMix" <Gr*********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Imports System.Windows.Forms
Imports System.Convert
Imports Microsoft.VisualBasic.Financial
Public Class Chapter7
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim result As DialogResult
result = MessageBox.Show("Do you really want to quit", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
End Sub
Private Sub btnCreateAccount_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCreateAccount.Click
DataGridView1.Columns.Add("Column1", "Loan Amount")
DataGridView1.Columns.Add("Column2", "Annual Interest Rate")
DataGridView1.Columns.Add("Column3", "Term in Years")
DataGridView1.Columns.Add("Column4", "Result Cell")
btnCreateAccount.Enabled = False
btnDeleteAccount.Enabled = True
btnAddAccount.Enabled = True
btnCalculate.Enabled = True
End Sub
Private Sub btnAddRow_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddAccount.Click
DataGridView1.Rows.Add()
End Sub
Private Sub btnDeleteRow_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDeleteAccount.Click
DataGridView1.Rows.RemoveAt(0)
End Sub
Private Sub Chapter7_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
btnDeleteAccount.Enabled = False
btnAddAccount.Enabled = False
btnCalculate.Enabled = False
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Dim InterestRate As Double
Dim Payments As Integer
Dim LoanAmountP As Double
Dim LoanAmountC As Double
Dim LoanAmountCell As DataGridViewCell 'reference cell
Dim InterestCell As DataGridViewCell 'reference cell
Dim TermCell As DataGridViewCell 'reference cell
Dim ResultCell As DataGridViewCell 'reference cell
Dim MiddleMan As String
LoanAmountCell = DataGridView1.Rows(0).Cells(0)
MiddleMan = LoanAmountCell.ToString
LoanAmountP = ToDouble(MiddleMan) ' converts the string i just
got from the datagridview cell into a double
InterestCell = DataGridView1.Rows(1).Cells(1)
TermCell = DataGridView1.Rows(2).Cells(2)
InterestRate = (ToDouble(InterestCell.ToString) * 0.1) / 12
Payments = CInt(TermCell.ToString) * 12
'LoanAmountP = (LoanAmountP * InterestRate * Payments) -
LoanAmountP
ResultCell = Pmt(InterestRate, Payments, LoanAmountP)
End Sub
End Class
My pmt is having trouble taking the loanAmountP variable, i was
wondering if anyway has any hints on what the problem might be.
Hi,
A datagridviewcell's ToString will return the cell type
(datagridviewtextboxcolumn) not is value. Use the cells value instead.
InterestRate = (ToDouble(InterestCell.Value.ToString) * 0.1) / 12
Payments = CInt(TermCell.Value.ToString) * 12
Ken
----------------------
"GrispernMix" <Gr*********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Imports System.Windows.Forms
Imports System.Convert
Imports Microsoft.VisualBasic.Financial
Public Class Chapter7
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim result As DialogResult
result = MessageBox.Show("Do you really want to quit", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
End Sub
Private Sub btnCreateAccount_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCreateAccount.Click
DataGridView1.Columns.Add("Column1", "Loan Amount")
DataGridView1.Columns.Add("Column2", "Annual Interest Rate")
DataGridView1.Columns.Add("Column3", "Term in Years")
DataGridView1.Columns.Add("Column4", "Result Cell")
btnCreateAccount.Enabled = False
btnDeleteAccount.Enabled = True
btnAddAccount.Enabled = True
btnCalculate.Enabled = True
End Sub
Private Sub btnAddRow_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddAccount.Click
DataGridView1.Rows.Add()
End Sub
Private Sub btnDeleteRow_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDeleteAccount.Click
DataGridView1.Rows.RemoveAt(0)
End Sub
Private Sub Chapter7_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
btnDeleteAccount.Enabled = False
btnAddAccount.Enabled = False
btnCalculate.Enabled = False
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Dim InterestRate As Double
Dim Payments As Integer
Dim LoanAmountP As Double
Dim LoanAmountC As Double
Dim LoanAmountCell As DataGridViewCell 'reference cell
Dim InterestCell As DataGridViewCell 'reference cell
Dim TermCell As DataGridViewCell 'reference cell
Dim ResultCell As DataGridViewCell 'reference cell
Dim MiddleMan As String
LoanAmountCell = DataGridView1.Rows(0).Cells(0)
MiddleMan = LoanAmountCell.ToString
LoanAmountP = ToDouble(MiddleMan) ' converts the string i just
got from the datagridview cell into a double
InterestCell = DataGridView1.Rows(1).Cells(1)
TermCell = DataGridView1.Rows(2).Cells(2)
InterestRate = (ToDouble(InterestCell.ToString) * 0.1) / 12
Payments = CInt(TermCell.ToString) * 12
'LoanAmountP = (LoanAmountP * InterestRate * Payments) -
LoanAmountP
ResultCell = Pmt(InterestRate, Payments, LoanAmountP)
End Sub
End Class
My pmt is having trouble taking the loanAmountP variable, i was
wondering if anyway has any hints on what the problem might be.
Hi,
The DataGridViewCell's ToString method returns the cell type (ie
datagridviewtextboxcell) not its value. Use it's value property instead.
InterestRate = (ToDouble(InterestCell.Value.ToString) * 0.1) / 12
Payments = CInt(TermCell.Value.ToString) * 12
Ken
------------------------
"GrispernMix" <Gr*********@gmail.comwrote in message
news:11**********************@m7g2000cwm.googlegro ups.com...
Imports System.Windows.Forms
Imports System.Convert
Imports Microsoft.VisualBasic.Financial
Public Class Chapter7
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs)
Dim result As DialogResult
result = MessageBox.Show("Do you really want to quit", "Exit",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As
System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles
DataGridView1.CellContentClick
End Sub
Private Sub btnCreateAccount_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCreateAccount.Click
DataGridView1.Columns.Add("Column1", "Loan Amount")
DataGridView1.Columns.Add("Column2", "Annual Interest Rate")
DataGridView1.Columns.Add("Column3", "Term in Years")
DataGridView1.Columns.Add("Column4", "Result Cell")
btnCreateAccount.Enabled = False
btnDeleteAccount.Enabled = True
btnAddAccount.Enabled = True
btnCalculate.Enabled = True
End Sub
Private Sub btnAddRow_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddAccount.Click
DataGridView1.Rows.Add()
End Sub
Private Sub btnDeleteRow_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnDeleteAccount.Click
DataGridView1.Rows.RemoveAt(0)
End Sub
Private Sub Chapter7_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
btnDeleteAccount.Enabled = False
btnAddAccount.Enabled = False
btnCalculate.Enabled = False
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs)
Dim InterestRate As Double
Dim Payments As Integer
Dim LoanAmountP As Double
Dim LoanAmountC As Double
Dim LoanAmountCell As DataGridViewCell 'reference cell
Dim InterestCell As DataGridViewCell 'reference cell
Dim TermCell As DataGridViewCell 'reference cell
Dim ResultCell As DataGridViewCell 'reference cell
Dim MiddleMan As String
LoanAmountCell = DataGridView1.Rows(0).Cells(0)
MiddleMan = LoanAmountCell.ToString
LoanAmountP = ToDouble(MiddleMan) ' converts the string i just
got from the datagridview cell into a double
InterestCell = DataGridView1.Rows(1).Cells(1)
TermCell = DataGridView1.Rows(2).Cells(2)
InterestRate = (ToDouble(InterestCell.ToString) * 0.1) / 12
Payments = CInt(TermCell.ToString) * 12
'LoanAmountP = (LoanAmountP * InterestRate * Payments) -
LoanAmountP
ResultCell = Pmt(InterestRate, Payments, LoanAmountP)
End Sub
End Class
My pmt is having trouble taking the loanAmountP variable, i was
wondering if anyway has any hints on what the problem might be. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: TheSteph |
last post by:
Using : Windows 2000 Pro SP4 / VS.NET 2005 / .NET 2.0 / C# - All updates
done.
I have several bugs when I use the DataGridView : When scrolling (or after
scrolling) the grid have these...
|
by: Daniel Manes |
last post by:
I'm baffled. I have a column in a SQL Server Express database called
"Longitude," which is a float. When I view the table in a DataGridView,
some of the numbers, which only have two decimal places...
|
by: romerve |
last post by:
Hello; i am having some problems trying to get a form that has a
datagridview to refresh after a new record is created.
I have a MDI container and menu form and add new record form; the menu...
|
by: dave18 |
last post by:
Hello all!
I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone...
|
by: TheSteph |
last post by:
Hi !
I have a DataGridView with a Date (DateTime) Column.
When a user edit the cell and change the date I woulk like to allow him to
write "081501" and programmatically transform the entered...
|
by: Avedo |
last post by:
Hello!
I have a form application with a DataGridView, and an Save/Delete and Cancel button. When the application is opened, it is supplied an XML file that may or may not exist, and display the...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
| |