All pastes #419679 Raw Edit

Someone

public text v1 · immutable
·published 2007-04-01 15:16 UTC
rendered paste body
 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

    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 <> ""
            strTicker = Convert.ToString(txtTicker.Text)
            strPrice = Convert.ToString(txtPrice.Text)
            strShares = Convert.ToString(txtShares.Text)
            dblPrice = Convert.ToDouble(strPrice)
            dblshares = Convert.ToDouble(strShares)
            dblBasis = dblPrice * dblshares
            dblValue = dblPrice * dblshares
            dblTotalValue = dblTotalValue + dblValue
            strBasis = Convert.ToString(dblBasis)
            strValue = Convert.ToString(dblValue)
            strTotalValue = Convert.ToString(dblTotalValue)
            For Each itm In lstCurrentPort.Items
            Next
            lviCurrentPort = New ListViewItem(txtTicker.Text)
            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
        Loop
    End Sub