I am making a solution in Visual Studio 2017 that emulates a simple type of invoice, the user enters the values through a textbox, gives the "Add" button and the data is entered in a Data Grid View, then by pressing the "Calculate" button, the total amount is calculated, the VAT of that amount and then the total amount of the amount and VAT. The problem is that the calculation of the total (amount + VAT) is not added, only both concatenated values are printed. Why could this be happening?
This is my code:
Public Class Form1
Dim importePR As Double
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
importePR = txtcantidad.Text * txtprecio.Text
Me.DGV1.Rows.Add(txtdescrip.Text, txtcantidad.Text, txtprecio.Text, importePR)
txtdescrip.Clear()
txtcantidad.Clear()
txtprecio.Clear()
End Sub
Private Sub btnBorrar_Click(sender As Object, e As EventArgs) Handles btnBorrar.Click
DGV1.Rows.Clear()
txtdescrip.Clear()
txtcantidad.Clear()
txtprecio.Clear()
txtimporte.Clear()
txtIVA.Clear()
txttotal.Clear()
txtdescrip.Text = " "
txtcantidad.Text = " "
txtprecio.Text = " "
End Sub
Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DGV1.CellContentClick
End Sub
Private Sub btnCalcular_Click(sender As Object, e As EventArgs) Handles btnCalcular.Click
Dim importe As Double
Dim ImpTotal As Double
Dim fila As DataGridViewRow = New DataGridViewRow()
For Each fila In DGV1.Rows
importe += Convert.ToDouble(fila.Cells("Importe").Value)
Next
txtimporte.Text = Convert.ToString(importe)
txtIVA.Text = txtimporte.Text * 0.16
ImpTotal = txtimporte.Text + txtIVA.Text
txttotal.Text = ImpTotal
End Sub
End Class