title: How to fix "Too many arguments"-error
body: <p>im working on this point of sale system in vb and im stuck on an error</p>
  
  <blockquote>
    <p>Error 2   Too many arguments to 'Public Overridable Overloads Function
    Insert(ItemName As String, BuyPrice As Integer?, SellPrice As
    Integer?) As Integer'.</p>
  </blockquote>
  
  <p>how can i clear it?</p>
  
  <p>the double stared <code>**</code> is where the error is</p>
  
  <p>my code: add item window</p>
  
  <pre><code>Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  
     Public Class AddItem
  
  Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
      Me.DialogResult = Windows.Forms.DialogResult.Cancel
  End Sub
  
  'used to insert the item
  
  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  
      'perform validation for barcode
      If TextBox1.Text.Trim = "" Then
          MsgBox("You should enter a barcode number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox1.Focus()
          Exit Sub
  
      End If
  
      If Not IsNumeric(TextBox1.Text) Then
          MsgBox("You should enter a numeric barcode number", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox1.Focus()
          Exit Sub
      End If
  
      If TextBox1.Text.Contains(".") Or TextBox1.Text.Contains("-") Then
          MsgBox("The barcode number should not contain special characters", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox1.Focus()
          Exit Sub
      End If
  
      'perform check for the item name
      If TextBox2.Text.Trim = "" Then
          MsgBox("You should enter a name for the item", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox2.Focus()
          Exit Sub
  
      End If
  
      'perform a check for the buy price
      If TextBox3.Text.Trim = "" Then
          MsgBox("You should enter the buying price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox3.Focus()
          Exit Sub
  
      End If
  
      If Not IsNumeric(TextBox3.Text) Then
          MsgBox("You should enter a numeric buying price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox3.Focus()
          Exit Sub
      End If
  
      Dim BuyPrice As Decimal = Decimal.Parse(TextBox3.Text)
      If BuyPrice &lt; 0 Then
          MsgBox("The buying price cannot be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox3.Focus()
          Exit Sub
      End If
  
      'perform a check for the selling price
      If TextBox4.Text.Trim = "" Then
          MsgBox("You should enter the selling price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox4.Focus()
          Exit Sub
  
      End If
  
      If Not IsNumeric(TextBox4.Text) Then
          MsgBox("You should enter a numeric selling price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox4.Focus()
          Exit Sub
      End If
  
      Dim SellPrice As Decimal = Decimal.Parse(TextBox4.Text)
      If SellPrice &lt; 0 Then
          MsgBox("The selling price cannot be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox4.Focus()
          Exit Sub
      End If
  
      If SellPrice &lt;= BuyPrice Then
          MsgBox("The selling price cannot be less than buying price", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          TextBox4.Focus()
          Exit Sub
      End If
  
      'perform check for quantity
      'If Not IsNumeric(TextBox5.Text) Then
      'MsgBox("You should enter a numeric digits", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
      'TextBox5.Focus()
      'Exit Sub
      'End If
  
      'Dim Quantity As Decimal = Decimal.Parse(TextBox5.Text)
      'If Quantity &lt; 0 Then
      'MsgBox("Quantity cant be negative", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
      ' TextBox5.Focus()
      'Exit Sub
      'End If
  
  
      'insert the item
  
      Try
          'create the adapter
          Dim TA As New POSDSTableAdapters.ItemsTableAdapter
  
          'insert the item
          'TA.Insert(TextBox1.Text, TextBox2.Text, BuyPrice, SellPrice, Quantity)
          TA.Insert(TextBox2.Text, BuyPrice, SellPrice)
  
  
          Me.DialogResult = Windows.Forms.DialogResult.OK
  
      Catch ex As Exception
  
          'display error message
          'handle error
          MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
  
      End Try
  End Sub
  
  Private Sub AddItem_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  
  End Sub
  </code></pre>
  
  <p>End Class</p>
  
  <p>main window code:
  Public Class MainWindow</p>
  
  <pre><code>Private Sub MainWindow_Load(sender As Object, e As EventArgs) Handles MyBase.Load
      'TODO: This line of code loads data into the 'MyDataset.Items' table. You can move, or remove it, as needed.
      Me.ItemsTA.Fill(Me.MyDataset.Items)
  
      Try
  
  
      'get the username from the user
          'Dim USRWin As New PasswordPicker
  
      'get the password from the user
          ' Dim PSWWin As New PasswordPicker
  
  
      'if the user hits the exit button then stop executing the program
          'If PSWWin.ShowDialog &lt;&gt; Windows.Forms.DialogResult.OK Then
  
          'End
  
          ' End If
  
          'get the usernme
          'Dim USR As String = USRWin.TextBox1.text
          'get the password
          'Dim PSW As String = PSWWin.TextBox2.text
  
  
          'get the password from the database
          ' Dim TA As New POSDSTableAdapters.ValuesTableAdapter
          'Dim TB = TA.GetDataByKey("password")
          ' Dim DBPSW As String = TB.Rows(0).Item(1)
  
          'check the passwords match
          ' If PSW &lt;&gt; DBPSW Then
          'MsgBox("Invalid password", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          ' End If
  
          'get the username
          ' Dim TK = TA.GetDataByKey("username")
          'Dim DBUSR As String = TK.Rows(0).Item(2)
  
          'check the username match
          'If USR &lt;&gt; DBUSR Then
          'MsgBox("Invalid username", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
          'End If
  
          'load the items info from db into the dataset
          ItemsTA.Fill(MyDataset.Items)
  
  
      Catch ex As Exception
  
          'handle error
          MsgBox(ex.Message, MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly)
  
      End Try
  End Sub
  
  Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs)
  
  End Sub
  
  'add item to the db
  Private Sub AddItemToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AddItemToolStripMenuItem.Click
      Dim AddItemWindow As New AddItem
      If AddItemWindow.ShowDialog = Windows.Forms.DialogResult.OK Then
          'load the info of items from db
          ItemsTA.Fill(MyDataset.Items)
      End If
  
  
  End Sub
  
  'used to select an item
  Private Sub EditItemToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EditItemToolStripMenuItem.Click
  
      'make sure an item is selected
      If DataGridView1.SelectedRows.Count = 0 Then
          Exit Sub
      End If
  
      'get the barcode of the item
      Dim Barcode = DataGridView1.SelectedRows(0).Cells(0).Value
  
      'create the edit window
      Dim EditItemWindow As New EditItem
  
      'fill the window with information
      EditItemWindow.FillItemInfo(Barcode)
  
      If EditItemWindow.ShowDialog = Windows.Forms.DialogResult.OK Then
          'load the info of items from db
          ItemsTA.Fill(MyDataset.Items)
      End If
  End Sub
  </code></pre>
  
  <p>End Class</p>