我的表格中有两个面板。我创建了两个函数来获取所有文本框及其值。我需要一种方法来获取乘法值,即(使用panel1
中的第一个文本框乘以panel2
中的第一个文本框,依此类推)。
Private Function getallTextBoxes(ByVal container As ContainerControl) As Dictionary(Of String, TextBox)
Dim allTextBoxes As New Dictionary(Of String, TextBox)
For Each ctrl As Control In container.Controls
If TypeOf ctrl Is TextBox Then
allTextBoxes.Add(ctrl.Name, ctrl)
End If
Next
Return allTextBoxes
End Function
Private Function getTextBoxValues(ByVal textBoxDefs As IDictionary(Of String, TextBox)) As Dictionary(Of String, String)
Dim textBoxValues As New Dictionary(Of String, String)
For Each tbxDef As KeyValuePair(Of String, TextBox) In textBoxDefs
Dim tbx As TextBox = tbxDef.Value
Dim name As String = tbx.Name
Dim value As String = tbx.Text
textBoxValues.Add(name, value)
Next
Return textBoxValues
End Function