vb.net - 从并行数组中获取值并在下一行插入新值
问题描述
https://i.stack.imgur.com/NTZa5.jpg
我在添加按钮中的代码
Dim item() As String = {"Hardisk", "Pen Drive", "Mouse", "Memory", "Keyboard"}
Dim price() As Decimal = {200.0, 57.0, 45.0, 130.0, 58.0}
Dim counter As Integer
Dim items As String
Dim quantity As String
Dim findItem As String
Dim find As Boolean = False
lblOut.Text = "ITEM" & vbTab & "QTY" & vbTab & "PRICE" & vbTab & "SUBTOTAL" & vbNewLine
items = txtItem.Text
quantity = txtQuantity.Text
findItem = items
itemPrice = subtotal
For counter = 0 To 4
If findItem = lblOut.Text(counter) Then
find = True
End If
Next
lblOut.Text = lblOut.Text & items & vbTab & quantity & vbTab & itemPrice & vbTab & subtotal & vbNewLine
End Sub
当我在项目框中输入我的项目时,它应该在价格数组中搜索价格并显示到价格和 * 的文本框区域以及数量。然后我可以为新行添加下一项。
我面临的问题是当我将商品插入商品区域时如何从商品中获取价格,系统检查代码中设置的值。
以及当我想在文本框中添加 now 值时如何转到下一行。
解决方案
推荐阅读
- reactjs - 如何优化大量子组件的重渲染?
- angular - 无法通过单击在 Angular 中选择单选按钮
- antlr4 - ANTLR 匹配错误的标记
- vba - 在电子邮件正文中使用 Excel VBA IF THEN 语句
- c - 在c中使用递归函数的寻路程序
- css - 使用 SCSS 和 nuxt 进行主题化
- elasticsearch - 您可以将现有的 Elasticsearch 索引与 Elastic App 搜索挂钩吗
- r - 重新编码多个变量的 R 解决方案
- angular - 订阅另一个组件中的服务变量?
- c# - Json 反序列化动态在 .NET Core 3.1 中不起作用