Too many arguments to 'Public Sub New'

jpdbay

Active member
Joined
Feb 22, 2006
Messages
31
Programming Experience
Beginner
Dear all,

I'm getting the above error when I added a new button in my form. I copy paste the same code like other button to load the form. Unfortunately, it is throwing the error. The code is:

If RefreshForm(New frmModify(m_HeadId)) = DialogResult.OK Then Refresh()
The error is pointing to m_HeadId but it doesn't throw any error for other button. The error is no more if I remove the parameter but I need to pass the parameter. m_HeadId is declared as Integer.

Can u explain why I'm getting the error:(

Thanks
 
have you coded your own New() sub to include that as a parameter? by default the New() sub doesnt accept any parameters unless you write your own
 
What do you expect to happen to that integer when the form is created? If you haven't provided code to do something with it then why would you pass it in? As JB says, you have to write your own constructor with an Integer argument and then you can use that value in your code.
 
Back
Top