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

时间:2015-09-30 10:05:46

标签: vb.net-2010

示例我按开始时间和文本框中连接的时间,当我开始时间与时间相同时,它将显示,当我按下保存它不会添加到datagridview。请帮我解决我的问题。这是我的保存代码:

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

1 个答案:

答案 0 :(得分:0)

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

以下是表单的外观:

enter image description here

现在你需要添加" Time" datagridview的列:

enter image description here

现在......按照我的步骤完成图片:

enter image description here

这是代码:

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

我希望我的答案对你有用:)