Try this
Code:Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load ListBox1.Items.Add("U-Ad ($350)") ListBox1.Items.Add("Striker ($190)") ListBox1.Items.Add("New Ad ($250)") ListBox1.Items.Add("Samson ($530)") End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim v As Decimal ListBox2.Items.Add(ListBox1.SelectedItem) Decimal.TryParse(TextBox1.Text, v) v += GetMoney(ListBox1.SelectedItem) TextBox1.Text = v.ToString End Sub Private Function GetMoney(ByVal strValue As String) As Decimal Dim a As Integer = strValue.IndexOf("($") Dim b As Integer = strValue.IndexOf(")") Dim v As String = strValue.Substring(a + 2, b - a - 2) Dim r As Decimal Decimal.TryParse(v, r) Return r End Function End Class





Reply With Quote