これは私がこれまでに持っているコードです:
Public Class firstForm
Dim sale(3, 4) As Integer
Dim numberSellers(3) As Integer
Dim numberProducts(4) As Integer
Private Sub addButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addButton.Click
Dim sellerLineInteger As Integer
Dim productColumnInteger As Integer
sellerLineInteger = sellerListBox.SelectedIndex
productColumnInteger = productListBox.SelectedIndex
' add in two dimensional array
If sellerLineInteger >= 0 And productColumnInteger >= 0 Then
sale(sellerLineInteger, productColumnInteger) = Decimal.Parse(saleTextBox.Text)
End If
saleTextBox.Clear()
saleTextBox.Focus()
End Sub
代わりに、このコードを別のクラス/フォームに入れたいと思います。このクラスは、ユーザーが入力した情報を保管するために使用されます。リスト ボックスが 2 つ、ボタンが 1 つ、テキスト ボックスが 1 つあります。ユーザーは各リスト ボックスで項目を選択し、テキスト ボックスに番号を入力してから、ボタンをクリックして情報をストックします。
別のクラスを使ってコードを実装しようとしましたが、動作しませんでしたが、上記のコードのように配置すると動作します。
編集:どうもありがとう!私はこれを少し試してみます。