quick5pnt0
Member
- Joined
- Oct 1, 2008
- Messages
- 9
- Programming Experience
- Beginner
I'm a complete newbie to this so if anyone can help it would be greatly appreciated.
I watched the Databinding video on msdn (here) and got a DataGridView working like the video said. However I'm trying to go from there and programatically enter the information into the DataGridView. However I'm completely stumped as to why it wont work.
You can view my code below for entering the data. Currently I can still manually enter the data into the grid and click this button and it'll save it to the database, however it won't add it programatically. Like I said I'm a complete rookie so I may be way off. Can anyone help?
EDIT: More information in the post below.
I watched the Databinding video on msdn (here) and got a DataGridView working like the video said. However I'm trying to go from there and programatically enter the information into the DataGridView. However I'm completely stumped as to why it wont work.
You can view my code below for entering the data. Currently I can still manually enter the data into the grid and click this button and it'll save it to the database, however it won't add it programatically. Like I said I'm a complete rookie so I may be way off. Can anyone help?
EDIT: More information in the post below.
VB.NET:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Numberofrow = Database1DataSet.Tables("times").Rows.Count + 1
row = Database1DataSet.Tables("times").NewRow
row(0) = Database1DataSet.Tables("times").Rows.Count + 1
row(1) = TextBox1.Text
row(2) = DateTime.Now
row(3) = Label1.Text
Database1DataSet.Tables("times").Rows.InsertAt(row, Numberofrow)
Database1DataSet.Tables("times").AcceptChanges()
TimesBindingSource.EndEdit()
Dim rowsaffected As Integer
TimesTableAdapter.Update(Database1DataSet.times)
MessageBox.Show(rowsaffected.ToString)
End Sub
Last edited: