I have an error in 'UserControl` form
namely in BunifuSnackbar but if I use it in the form there is no error.
the error is Value of type 'PgStockin' cannot be converted to 'Form'
Please guide Me.
Thanks
Partial Public Class PgStockin
Inherits UserControl
`The error is below this line of code, namely in the word `Me`
BunifuSnackbar2.Show(Me, "Please delete item detail first ", Bunifu.UI.WinForms.BunifuSnackbar.MessageTypes.Error, 5000, "",
Bunifu.UI.WinForms.BunifuSnackbar.Positions.MiddleCenter, Bunifu.UI.WinForms.BunifuSnackbar.Hosts.FormOwner)
End Class
A form and a user control are two different things. Clearly, that
Showmethod is expecting a form and you are passing it a user control. If you want to show a form, you need to create a form, not a user control.A user control is basically a container to which you can add other controls and then reuse them as a group. You design it in the same way as you would a form but you then use it in the same way you would any other control. It has to be added to a form or another child control on a form, just like any other control, not shown independently as you would a form.
So, the question is why you created a user control in the first place. Do you want to show it independently or do you want to add it to a form? If the answer is that you want to do both then you cannot do the former directly. You'd have to add your user control to a form and then show the form.