![]() |
|
|||||||
| Winforms Grids Discussion related to grid controls of all types for Winforms |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
Short intro: Program is for managing supplies of the restaurant There are simple items to sell or complex items with ingredients. This part of program manage complex items with ingredients. From the list of items you chose item and then you can make a list of ingredients that item is consist of : ![]() Code:
CODE: Private Sub ListaSastojaka_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Manage Items to chose in combo box Me.MagacinTableAdapter.Fill(Me.KonobarDataSet.Magacin) 'To display without errasing table Me.MagacinSlozeniTableAdapter.ClearBeforeFill = True 'to show ingredients of choosen item by BrojID Me.MagacinSlozeniTableAdapter.Fillby(Me.KonobarDataSet.MagacinSlozeni, BrojID) End Sub Ingredients of item Palačinke (Pancakes): Combo box is linked to table Magacin (Items) List of item as ingredients is in table MagacinSlozeni (ItemsComplex) ![]() For better review further I will display a whole table: ![]() If you chose item form combo box and then put Kolicina (quantity), it appears in table like this: ![]() Code:
CODE: Private Sub MagacinSlozeniDataGridView_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles MagacinSlozeniDataGridView.CellEndEdit Dim Red As KonobarDataSet.MagacinSlozeniRow Red = CType(CType(Me.MagacinSlozeniBindingSource.Current, DataRowView).Row, KonobarDataSet.MagacinSlozeniRow) Dim NoviRed As KonobarDataSet.MagacinRow NoviRed = CType(CType(Me.MagacinBindingSource.Current, DataRowView).Row, KonobarDataSet.MagacinRow) Select Case e.ColumnIndex.ToString Case 2 Red.MagacinID = BrojID Red.cena = NoviRed.Cena Red.Naziv = NoviRed.Naziv Red.JedinicaMere = NoviRed.JedinicaMere Red.Kolicina = 0 Case 4 Case 5 'If item is complex: If NoviRed.Slozeni = True Then Dim KolicinaID As Decimal MagacinID = NoviRed.ID KolicinaID = Red.Kolicina Me.MagacinSlozeniTableAdapter.FillByMagacinID(Me.KonobarDataSet.MagacinSlozeni, BrojID, KolicinaID, MagacinID) Me.MagacinSlozeniBindingSource.MoveLast() End If End Select If you chose item that already have ingredients, like another Palacinka, all of them appears in table: ![]() Red item is Palacinka chosen from combo box and yellow are ingredients programmatically filled: ![]() And when the floppy is pressed: ![]() Code:
CODE: Private Sub MagacinSlozeniBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MagacinSlozeniBindingNavigatorSaveItem.Click Me.Validate() Me.MagacinSlozeniBindingSource.EndEdit() Me.MagacinSlozeniTableAdapter.Update(Me.KonobarDataSet.MagacinSlozeni) End Sub FINALY THE PROBLEM: Only items that are choose from the combo box is Saved, NONE of ingredients ![]() Where is the problem... How to solve it... http://www.ti.rs/problem/problem.html Done (not successfully) with: Visual Studio 2008 SQL Express 2005 |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|