Dim dblTotalValue As Double = 0
Dim strTicker, strPrice, strShares, strBasis, strValue, strTotalValue As String
Dim dblPrice, dblshares, dblBasis, dblValue As Double
Dim intStockCOunt, intIndex As Integer
Dim lviCurrentPort As New ListViewItem
Dim exactMatch As Boolean
Dim intCounter As Integer = 0
Private Sub btnAddStock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddStock.Click
If txtTicker.Text = "" Then
MessageBox.Show("Oops.. you left Ticker blank", "Ticker Blank")
txtTicker.Focus()
ElseIf txtShares.Text = "" Then
MessageBox.Show("Oops..you left Shares blank", "Shares Blank")
txtShares.Focus()
ElseIf txtPrice.Text = "" Then
MessageBox.Show("Oops..you left Price blank", "Price Blank")
txtPrice.Focus()
End If
Do While txtTicker.Text <> "" And txtShares.Text <> "" And txtPrice.Text <> ""
dblPrice = Convert.ToDouble(txtPrice.Text)
dblshares = Convert.ToDouble(txtShares.Text)
dblBasis = dblPrice * dblshares
dblValue = dblPrice * dblshares
dblTotalValue = dblTotalValue + dblValue
strBasis = Convert.ToString(dblBasis)
strValue = Convert.ToString(dblValue)
strTotalValue = Convert.ToString(dblTotalValue)
lviCurrentPort = New ListViewItem(txtTicker.Text)
If lstCurrentPort.Items.Contains(New ListViewItem(txtTicker.Text)) Then
MessageBox.Show("fuck you", "ERROR")
Else
lviCurrentPort.SubItems.Add(Format$(strBasis, "Currency"))
lviCurrentPort.SubItems.Add(txtShares.Text)
lviCurrentPort.SubItems.Add(Format$(txtPrice.Text, "Currency"))
lviCurrentPort.SubItems.Add(Format$(strValue, "Currency"))
lstCurrentPort.Items.Add(lviCurrentPort)
txtTotalValue.Text = Format$(strTotalValue, "Currency")
txtTicker.Text = ""
txtShares.Text = ""
txtPrice.Text = ""
If lstCurrentPort.Items.Count > 10 Then
MessageBox.Show("Trial Version only allows 10 entries")
End If
End If
Loop
End Sub