Entity Data Model & DataGridView - Creating new objects
- by AcousticBoom
I'm pretty new to the EDM, so bear with me. I have a windows form that has a DataGridView on it that's bound from the EDM I created. I figured out how to update my changes fine, but it's when the user creates a new row that I'm having a problem.
I tried numerous ways and many google searches, but came up with nothing so far.
Here's how the data is loaded:
Dim boilerID As Integer = DirectCast(ddlBoiler.SelectedValue, Integer)
Dim countryID As Integer = DirectCast(ddlCountry.SelectedValue, Integer)
Dim ratings = From r In _Context.Rating _
Where r.Boiler.Boiler_ID = boilerID _
And r.Country.Country_ID = countryID _
Order By r.Sequence _
Select r
RatingBindingSource.DataSource = ratings.ToList()
Also, all I'm doing to save the information right now is the following:
Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
_Context.SaveChanges()
End Sub
I want the user to be able to use the grid's "new row" feature to add new items to the database instead of having to click a button and open a new dialog. How would this be accomplished?
I can include some of the methods i tried for adding new items if anyone needs to see.
Thanks!