我如何在 vb.net 2010 [新手学生] 的 datagridview 中节省时间

how do i save time in datagridview in vb.net 2010 [Newbie student]

示例我按开始时间和文本框中连接的时间,当我开始时间与输出时间相同时,它会显示,当我按保存时,它不会添加到数据网格视图。请帮我解决我的问题。这是我的保存代码:

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click

    Table1BindingSource.AddNew()
    Me.Validate()
    Me.Table1BindingSource.EndEdit()
    Me.Table1TableAdapter.Update(Me.OpenDataSet.Table1)

End Sub

好的,我解决了你的问题....

您的表单应如下所示:

现在您需要将 "Time" 列添加到数据网格视图:

现在...按照我在图片中的步骤操作:

这是代码:

Public Class Form1

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Table1BindingSource.Rows.Add()
    Table1BindingSource.Rows(Table1BindingSource.Rows.Count - 1).Cells(0).Value = TextBox1.Text & Table1BindingSource.Rows.Count
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CountTimer.Tick
    TextBox1.Text += 1
End Sub
End Class

希望我的回答对您有用:)