I am an absolute beginner. But I searched the net. There are not many example shown in VB anywhere.
I have created a test project which holds the win form. Then added another project which holds the Entity Model, after building the Model I added a reference of this to the Win form project. After that I added the Model object as a datasource.
I dragged the datasource controls into the form and added the below code.
Collapse | Copy Code
Private context As TestModelEntities
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
context = New TestModelEntities
Dim query = context.employees
EmployeeBindingSource.DataSource = query.ToList
Private Sub DepartmentBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmployeeBindingNavigatorSaveItem.Click
MessageBox.Show("Changes saved to the database.")
Catch ex As Exception
I am scratching my head all day. Don't know what I am doing wrong.
0 · ·