Мне нужно отправить выбранный элемент этой формы в другую форму, в настоящее время я пытался использовать аккумулятор, но я пробовал другие вещи. Моя основная форма, в которую мне нужно отправлять вещи, это frmshoppingcart.lstproductselected.text, это из моей печатной книги, но у меня есть другая форма с аудиокнигами, которая имеет ту же проблему, так как она в значительной степени идентична коду
Public Class frmPrintBooks
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
Me.Close()
End Sub
Private Sub btnAddBooks_Click(sender As Object, e As EventArgs) Handles btnAddBooks.Click
' Declare Variables and Constants
Dim decSubtotal As Decimal
Dim decTax As Decimal
Dim decShipping As Decimal
Dim decTotal As Decimal
Const decTaxTotal As Decimal = 0.6D
Const decShippingRate As Decimal = 2D
If lstPrintBooks.SelectedIndex = 0 Then
decSubtotal = CDec(11.95)
decTax = CDec(11.95 * decTaxTotal)
decShipping = decShippingRate * 1
decTotal = decSubtotal + decTax + decShipping
Dim temp As String
temp = lstPrintBooks.SelectedItem.text
frmShoppingCart.lstProductsSelected.Text = temp
ElseIf lstPrintBooks.SelectedIndex = 1 Then
decSubtotal = CDec(14.5)
decTax = CDec(14.5 * decTaxTotal)
decShipping = decShippingRate * 1
decTotal = decSubtotal + decTax + decShipping
ElseIf lstPrintBooks.SelectedIndex = 2 Then
decSubtotal = CDec(29.95)
decTax = CDec(29.95 * decTaxTotal)
decShipping = decShippingRate * 1
decTotal = decSubtotal + decTax + decShipping
ElseIf lstPrintBooks.SelectedIndex = 3 Then
decSubtotal = CDec(18.5)
decTax = CDec(18.5 * decTaxTotal)
decShipping = decShippingRate * 1
decTotal = decSubtotal + decTax + decShipping
End If
' Show total due
frmShoppingCart.txtSubtotal.Text = decSubtotal.ToString("c")
frmShoppingCart.txtTax.Text = decTax.ToString("c")
frmShoppingCart.txtShipping.Text = decShippingRate.ToString("c")
frmShoppingCart.txtTotal.Text = decTotal.ToString("c")
End Sub
End Class