vb.net中如何把textbox里的内容填充到datagridview中?

2025-01-05 10:55:44
推荐回答(2个)
回答1:

1,调用DataTable类,绑定字段就行了
2,借用数据库,保存时将信息插入数据库,DV绑定

回答2:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myText() As String
myText = TextBox1.Lines
If DataGridView1.RowCount < myText.GetUpperBound(0) + 1 Then
DataGridView1.RowCount = myText.GetUpperBound(0) + 1
End If
For i = 0 To myText.GetUpperBound(0)
DataGridView1.Item(0, i).Value = myText(i)
Next
End Sub