paulthepaddy
Well-known member
Didn't Know how To Title This, Sorry For Generic Title.
Hi all, i am trying to do something in theory seems quite simple to me but i just cant get my head around it.
I am using the Entity Framework Database First Model, and i am trying to create an invoice from a previously made order.
I am using alot of binding sources to do what i am trying to do and i think im doing it' the proper way'
but first off the yellow box simply retrieves a list of cars depending on the customer and the department like so, i had wanted to use a checkedListBox instead but il enquire about that after i can get the main functionality of the form working.
And the result is then binded the Red(left) hand box, theirs a few textboxes with info but my main problem is the Blue box. i am using a BindingSource to bind the Listboxs item and the orders
The Orders Datagridview (Blue) i have added a checkbox column for the user to select the orders to go onto the invoice, but i am struggling to get the orders added to the invoice
as far as i can work out i can either go like so Me.Invoice.Cars.Add(car) (this will add all order numbers related to the car even if i have removed the unwanted orders from the car.orders
or i can go Me.Invoice.Orders.Add(ord) but entity framework isn't filling in the car information.
if you guys really want i can post code, but i am more curious how you would approach this as this would be very similar to a normal sales application.
dont get me wrong im not looking for someone to code this form me but more the logic behind it, eg bind this to this loop through this and so on.
Thanks

Hi all, i am trying to do something in theory seems quite simple to me but i just cant get my head around it.
I am using the Entity Framework Database First Model, and i am trying to create an invoice from a previously made order.
I am using alot of binding sources to do what i am trying to do and i think im doing it' the proper way'
but first off the yellow box simply retrieves a list of cars depending on the customer and the department like so, i had wanted to use a checkedListBox instead but il enquire about that after i can get the main functionality of the form working.
VB.NET:
Me.listofcars = From Car In db.Cars Where Car.Dealership_ID = Invoice.Dealership_ID And Car.FullyPaid = False AndAlso Car.Orders.Any(Function(ord As Order) ord.Department_ID = Invoice.Department_ID) Select Car
CarBindingSource.DataSource = listofcars
Me.lbCars.DataSource = CarBindingSource
Me.lbCars.DisplayMember = "Reg"
And the result is then binded the Red(left) hand box, theirs a few textboxes with info but my main problem is the Blue box. i am using a BindingSource to bind the Listboxs item and the orders
VB.NET:
Private Sub lb_Cars_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lbCars.SelectedIndexChanged
Dim car As Car = CType(Me.lbCars.SelectedItem, Car)
OrdersBindingSource.DataSource = car.Orders
The Orders Datagridview (Blue) i have added a checkbox column for the user to select the orders to go onto the invoice, but i am struggling to get the orders added to the invoice
as far as i can work out i can either go like so Me.Invoice.Cars.Add(car) (this will add all order numbers related to the car even if i have removed the unwanted orders from the car.orders
or i can go Me.Invoice.Orders.Add(ord) but entity framework isn't filling in the car information.
if you guys really want i can post code, but i am more curious how you would approach this as this would be very similar to a normal sales application.
dont get me wrong im not looking for someone to code this form me but more the logic behind it, eg bind this to this loop through this and so on.
Thanks
