I just started taking VB 2005 in school and decided to make my own program.

Right now you enter Cost, Rebate and Sold into text boxes respectively. When you get to the Sold textbox their is a textChanged Event which displays the profit while your typing it in. When you’re done hit the "Add" button and it will calculate the profit again and display it in the list box.

This is the error I get: "Conversion from string "" to type 'Double' is not valid."

VB Code:
  1. Public Class business
  2.  
  3.     Dim fmtStrg As String = "{0, -19}{1, 12:C}{2, 12:C}{3, 12:C}{4, 12:C}"
  4.  
  5.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  6.         lstBox.Items.Add(String.Format(fmtStrg, "Item", "Cost", "Rebate", "Sold", "Profit"))
  7.         lstBox.Items.Add(String.Format(fmtStrg, "-------------------", "-----------", "-----------", "-----------", "-----------"))
  8.     End Sub
  9.  
  10.     Private Sub txtAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
  11.         Dim Item As String
  12.         Dim Cost, Rebate, Sold, Profit As Double
  13.  
  14.         If txtItem.Text = "" Then
  15.             MsgBox("Cannot have empty item field.", 0, "Error")
  16.         End If
  17.  
  18.         Item = CStr(txtItem.Text)
  19.         Cost = CDbl(txtCost.Text)
  20.         Sold = CDbl(txtSold.Text)
  21.         Rebate = CDbl(txtRebate.Text)
  22.  
  23.         Profit = (Sold + Rebate) - Cost
  24.  
  25.         lstBox.Items.Add(String.Format(fmtStrg, Item, Cost, Rebate, Sold, Profit))
  26.         txtTotalProfit.Text = FormatCurrency(Profit + CDbl(txtTotalProfit.Text))
  27.  
  28.         txtCost.Clear()
  29.         txtRebate.Text = 0
  30.         txtSold.Clear()
  31.         txtItem.Clear()
  32.  
  33.         txtItem.Focus()
  34.     End Sub
  35.     Private Sub txtSold_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtSold.TextChanged
  36.         Dim Cost, Rebate, Sold As Double
  37.  
  38.         Cost = CDbl(txtCost.Text)
  39.         Sold = CDbl(txtSold.Text)
  40.         Rebate = CDbl(txtRebate.Text)
  41.  
  42.         txtProfit.Text = CStr((Sold + Rebate) - Cost)
  43.     End Sub
  44. End Class

Thank You.