i am working on Shopping cart

in the AddToCart function
at this line >>> cost1 = Decimal.Parse(ddlProducts.SelectedItem.Value)
there is an error
this is the error message
Input string was not in a correct format.

Sub AddToCart(s As Object, e As EventArgs)
	objDT = Session("Cart")
	Dim Product = ddlProducts.SelectedItem.Text
	Dim blnMatch As Boolean = False

	For Each objDR In objDT.Rows
		If objDR("Product") = Product Then
			objDR("Quantity") += txtQuantity.Text
			blnMatch = True
			Exit For
		End If

        If Not blnMatch Then
            objDR = objDT.NewRow
            objDR("Quantity") = txtQuantity.Text
            objDR("Product") = ddlProducts.SelectedItem.Text
            Dim cost1
            cost1 = Decimal.Parse(ddlProducts.SelectedItem.Value)
            objDR("Cost") = cost1

        End If
	Session("Cart") = objDT

        dg.DataSource = objDT
        lblTotal.Text = "$" & GetItemTotal()
End Sub

need help plz :icon_sad:

I think datatype conversion problem.

Try this : cost1 = Decimal.Parse(Convert.ToString(ddlProducts.SelectedItem.Value)) or cost1 = Decimal.Parse(ddlProducts.SelectedItem.Text)