我正在创建一个函数来从DataGridView
获取值。
Private Function ItemaDataTransfer()
Try
Dim Purfrm As New Entr_PurchaseForm
Dim i As Integer
i = FindItemDataGridView.CurrentRow.Index
If i > 0 Then
If Not String.IsNullOrEmpty(FindItemDataGridView.Item(0, i).Value.ToString) Then
Purfrm.ItemIDLabel.Text = FindItemDataGridView.Item(0, i).Value.ToString
Else
Purfrm.ItemIDLabel.Text = 0
End If
End If
Catch ex As ApplicationException
MessageBox.Show("Error" & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Function
这是我的表格:
答案 0 :(得分:0)
希望这会有所帮助。如果确实如此,请通过答案左侧的复选标记接受我的回答。
Private Sub ItemaDataTransfer()
Try
Dim i As Integer = FindItemDataGridView.CurrentRow.Index
If i > 0 Then
If Not String.IsNullOrEmpty(FindItemDataGridView.Item(0, i).Value.ToString) Then
Entr_PurchaseForm.ItemIDLabel.Text = FindItemDataGridView.Item(0, i).Value.ToString
Else
Entr_PurchaseForm.ItemIDLabel.Text = "0"
End If
End If
Catch ex As Exception
MessageBox.Show("Error" & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub