I need to call a form from button click

manny cash

Member
Joined
Oct 19, 2024
Messages
15
Programming Experience
Beginner
This is my little code: My errors are in import system.data.sqlclient and the other one is handle withevents variable.
Thank you everyone in advance

Imports sysmtem.data.sqlclient
Public Class Utilities
Public Class Main

Public Sub Buttonloadutilities_Click(sender As Object, e As EventArgs) Handles Buttonloadutilities.Click

' Create an instance of Utilities form
Dim Utilities As New Utilities()

' Show utilities form
Utilities.Show()
End Sub
End Class


End Class
 
Why do you have a class named Main inside a class named Utilities? That is unlikely to make sense regardless but it certainly doesn't if Main is a form. The fact that Main creates an instance of Utilities makes it even more weird. What are you actually trying to achieve with those two classes and how did you end up with one inside the other?
 
You say:
My errors are in import system.data.sqlclient
but your actual code is:
VB.NET:
Imports sysmtem.data.sqlclient
"sysmtem" is not equal to "system". If that really is the problem then it suggests that you didn't make any effort at all to solve the problem for yourself. That is backed up by the fact that you tell us that you have errors but you don't provide the error messages, which makes it seem like you didn't even read them yourself. Being a beginner means that you don't know a lot of stuff but it doesn't mean that you just abandon the logic that you would apply to problems in other areas. Be systematic, read what's in front of you and do what you can for yourself first, then provide ALL the relevant information to us.
 
I am Sorry, I was very exhausted. You helped me to finish it. Thank you and I appreciate your help. This issue is done.

Friend WithEvents BtnUttil As Button

'Call another form from Button Click
Private Sub BtbUtil_Click(sender As System.Object, e As System.EventArgs) _
Handles BtnUttil.Click
Dim Utilities = New Utilities()
Utilities.Show()
End Sub
 
Back
Top