Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to teach myself Visual Studio. I have created an add-in for excel (using visual basic) and added a button to a ribbon group.

I then added a form to the project and am trying to use the buttons click event to open the login form. When using frmLogin.show, I get "reference to a non-shared member requires an object reference".

I need to understand how to load other objects from this button click event.

Please advise.

What I have tried:

Private Sub btnLogIn_Click(sender As Object, e As RibbonControlEventArgs) Handles btnLogIn.Click
frmLogin.Show()
End Sub
Posted
Updated 19-Feb-23 1:29am
Comments
Richard MacCutchan 19-Feb-23 6:54am    
Where is frmLogin defined?
Leslie Gombart 19-Feb-23 7:01am    
Thanks Richard... I finally managed to find the answer!
Public Class Ribbon1
Dim uf As frmLogin
Private Sub Ribbon1_Load(ByVal sender As System.Object, ByVal e As RibbonUIEventArgs) Handles MyBase.Load

End Sub

Private Sub btnLogIn_Click(sender As Object, e As RibbonControlEventArgs) Handles btnLogIn.Click
uf = New frmLogin
uf.Show()
End Sub
End Class
Dave Kreskowiak 19-Feb-23 11:40am    
Visual Studio is an editor and debugger, not a language or a framework. It's not Visual Studio you're trying to learn, but VB.NET, C#, and others, as well as various programming frameworks, like .NET, VSTO, ASP.NET, MVC, WPF, Windows Forms, ...

1 solution

Answered only to remove from unanswered queue: solved by OP.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900