Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.           TblBroodjeBindingSource.Filter = "NaamBroodje like '" & txtNaam.Text & "*'"
  2.       TblBroodjeBindingSource.Filter = "Soort ='" & cboSoort.SelectedItem & "'"
  3.                     TblBroodjeBindingSource.Filter = Nothing    
  4.  
  5.  '*** invoegen
  6. Dim dr As DataRow
  7.         Dim aantal As Integer
  8.  
  9.         Try
  10.             aantal = Integer.Parse(nudAantal.Value)
  11.             dr = DtsKooKooShop.tblBestellingBroodje.NewtblBestellingBroodjeRow
  12.  
  13.             'MessageBox.Show("BroodjeID: " & NaamBroodjeComboBox.SelectedValue, "Broodje")
  14.            'MessageBox.Show("Aantal broodjes: " & aantal, "Aantal")
  15.  
  16.             dr.Item("Bestelling") = Integer.Parse(BestellingnummerLabel2.Text)
  17.             dr.Item("Broodje") = NaamBroodjeComboBox.SelectedValue
  18.             dr.Item("Aantal") = aantal
  19.  
  20.             DtsKooKooShop.tblBestellingBroodje.AddtblBestellingBroodjeRow(dr)
  21.             Me.TblBestellingBroodjeTableAdapter.Update(DtsKooKooShop.tblBestellingBroodje)
  22.             Me.DtsKooKooShop.AcceptChanges()
  23.  
  24.         Catch dubbel As OleDb.OleDbException
  25.             MessageBox.Show("Dit product werd al toegevoegd! Pas eventueel de hoeveelheid aan.", "Dubbel", MessageBoxButtons.OK, MessageBoxIcon.Error)
  26.             Me.DtsKooKooShop.RejectChanges()
  27.         End Try
  28.  
  29.  
  30.  
  31.  
  32.         If cboSoort.Text = "Wit brood" Then
  33.             TblBroodjeBindingSource.Filter = "Soort = 'Wit brood'"
  34.         Else
  35.             TblBroodjeBindingSource.Filter = "Soort = 'Bruin brood'"
  36.         End If
  37.  
  38.  
  39. '*** save
  40.        Dim blnNaam, blnVoornaam As Boolean
  41.         If AchternaamTextBox.Text = String.Empty Then
  42.             ErrProvider.SetError(AchternaamTextBox, "Naam moet ingevuld worden!")
  43.             AchternaamTextBox.Focus()
  44.         Else
  45.             ErrProvider.SetError(AchternaamTextBox, String.Empty)
  46.             blnNaam = True
  47.  
  48.         End If
  49.  
  50.         If VoornaamTextBox.Text = String.Empty Then
  51.             ErrProvider.SetError(VoornaamTextBox, "Voornaam moet ingevuld worden!")
  52.             VoornaamTextBox.Focus()
  53.         Else
  54.             ErrProvider.SetError(VoornaamTextBox, String.Empty)
  55.             blnVoornaam = True
  56.  
  57.         End If
  58.  
  59.  
  60.         If blnVoornaam = True And blnNaam = True Then
  61.             Me.Validate()
  62.             Me.TblKlantBindingSource.EndEdit()
  63.             Me.TableAdapterManager.UpdateAll(Me.DtsKooKooShop)
  64.         End If
  65.  
  66.  
  67.  
  68. '*** delete
  69.        Dim msgboxresult As MsgBoxResult
  70.         Dim strNaam As String
  71.         strNaam = AchternaamTextBox.Text
  72.  
  73.         msgboxresult = MessageBox.Show("Mag deze klant verwijderd worden?", "Klant " & AchternaamTextBox.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk)
  74.  
  75.         If msgboxresult = MsgBoxResult.Yes Then
  76.             TblKlantBindingSource.RemoveCurrent()
  77.             DtsKooKooShop.tblKlant.AcceptChanges()
  78.  
  79.             Me.Validate()
  80.             Me.TblKlantBindingSource.EndEdit()
  81.             Me.TableAdapterManager.UpdateAll(Me.DtsKooKooShop)
  82.  
  83.             MessageBox.Show("Klant " & strNaam & " is jammer genoeg verwijderd", "Verwijderd", MessageBoxButtons.OK, MessageBoxIcon.Information)
  84.         End If
  85.  
  86.  
  87. '*** validating
  88.        If NaamBroodjeTextBox.Text = String.Empty Then
  89.             ErrProvider.SetError(NaamBroodjeTextBox, "Naam moet ingevuld worden!")
  90.             NaamBroodjeTextBox.Focus()
  91.         Else
  92.             ErrProvider.SetError(NaamBroodjeTextBox, String.Empty)
  93.         End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement