Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TblBroodjeBindingSource.Filter = "NaamBroodje like '" & txtNaam.Text & "*'"
- TblBroodjeBindingSource.Filter = "Soort ='" & cboSoort.SelectedItem & "'"
- TblBroodjeBindingSource.Filter = Nothing
- '*** invoegen
- Dim dr As DataRow
- Dim aantal As Integer
- Try
- aantal = Integer.Parse(nudAantal.Value)
- dr = DtsKooKooShop.tblBestellingBroodje.NewtblBestellingBroodjeRow
- 'MessageBox.Show("BroodjeID: " & NaamBroodjeComboBox.SelectedValue, "Broodje")
- 'MessageBox.Show("Aantal broodjes: " & aantal, "Aantal")
- dr.Item("Bestelling") = Integer.Parse(BestellingnummerLabel2.Text)
- dr.Item("Broodje") = NaamBroodjeComboBox.SelectedValue
- dr.Item("Aantal") = aantal
- DtsKooKooShop.tblBestellingBroodje.AddtblBestellingBroodjeRow(dr)
- Me.TblBestellingBroodjeTableAdapter.Update(DtsKooKooShop.tblBestellingBroodje)
- Me.DtsKooKooShop.AcceptChanges()
- Catch dubbel As OleDb.OleDbException
- MessageBox.Show("Dit product werd al toegevoegd! Pas eventueel de hoeveelheid aan.", "Dubbel", MessageBoxButtons.OK, MessageBoxIcon.Error)
- Me.DtsKooKooShop.RejectChanges()
- End Try
- If cboSoort.Text = "Wit brood" Then
- TblBroodjeBindingSource.Filter = "Soort = 'Wit brood'"
- Else
- TblBroodjeBindingSource.Filter = "Soort = 'Bruin brood'"
- End If
- '*** save
- Dim blnNaam, blnVoornaam As Boolean
- If AchternaamTextBox.Text = String.Empty Then
- ErrProvider.SetError(AchternaamTextBox, "Naam moet ingevuld worden!")
- AchternaamTextBox.Focus()
- Else
- ErrProvider.SetError(AchternaamTextBox, String.Empty)
- blnNaam = True
- End If
- If VoornaamTextBox.Text = String.Empty Then
- ErrProvider.SetError(VoornaamTextBox, "Voornaam moet ingevuld worden!")
- VoornaamTextBox.Focus()
- Else
- ErrProvider.SetError(VoornaamTextBox, String.Empty)
- blnVoornaam = True
- End If
- If blnVoornaam = True And blnNaam = True Then
- Me.Validate()
- Me.TblKlantBindingSource.EndEdit()
- Me.TableAdapterManager.UpdateAll(Me.DtsKooKooShop)
- End If
- '*** delete
- Dim msgboxresult As MsgBoxResult
- Dim strNaam As String
- strNaam = AchternaamTextBox.Text
- msgboxresult = MessageBox.Show("Mag deze klant verwijderd worden?", "Klant " & AchternaamTextBox.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk)
- If msgboxresult = MsgBoxResult.Yes Then
- TblKlantBindingSource.RemoveCurrent()
- DtsKooKooShop.tblKlant.AcceptChanges()
- Me.Validate()
- Me.TblKlantBindingSource.EndEdit()
- Me.TableAdapterManager.UpdateAll(Me.DtsKooKooShop)
- MessageBox.Show("Klant " & strNaam & " is jammer genoeg verwijderd", "Verwijderd", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End If
- '*** validating
- If NaamBroodjeTextBox.Text = String.Empty Then
- ErrProvider.SetError(NaamBroodjeTextBox, "Naam moet ingevuld worden!")
- NaamBroodjeTextBox.Focus()
- Else
- ErrProvider.SetError(NaamBroodjeTextBox, String.Empty)
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement