Visual Basic .NET Forums    

Go Back   Visual Basic .NET Forums > Components & Controls > Grids > Winforms Grids

VB.NET Forums Newsletter Signup:
Email address:


Winforms Grids Discussion related to grid controls of all types for Winforms

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-30-2008, 10:39 AM
VB.NET Forum Newbie
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Aug 2008
Posts: 1
Reputation: 0
Vladimir Nikitovic is on a distinguished programming path ahead
Default DataGridView update problem

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
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -4. The time now is 3:11 PM.




Click to advertise here

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
For advertising opportunities click here.