Resolved BC30456 'ShowHelp' is not a member of 'ToolStripMenuItem'

g4naq

Member
Joined
Sep 6, 2021
Messages
9
Programming Experience
1-3
I have just created a new application using Visual Studio 2022 & created a new CHM file which has been added. For some reason when I compile this app I am getting the above error... can someone please point me in the direction of the problem? I have added what I thought were the correct changes..

ReadOnly strHelpPath As String = Path.Combine(Application.StartupPath, “Software.chm”)

HelpProvider.HelpNamespace = strHelpPath

Private Sub HelpContentsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles HelpContentsToolStripMenuItem.Click
Help.ShowHelp(Me, HelpProvider.HelpNamespace, HelpNavigator.TableOfContents)
End Sub
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,723
Location
Sydney, Australia
Programming Experience
10+
You have marked this thread Resolved but you haven't specified what the solution was, so we don't know whether it's actually resolved or that was a mistake, plus no one else who has a similar problem can benefit.

Either way, it would seem that you're trying to call System.Windows.Forms.Help.ShowHelp but you have a ToolStripMenuItem named Help and so your reference to Help in that code is being interpreted as the latter rather than the former. One solution would be to qualify the type in that code, i.e.
VB.NET:
Windows.Forms.Help.ShowHelp(Me, HelpProvider.HelpNamespace, HelpNavigator.TableOfContents)
or:
VB.NET:
System.Windows.Forms.Help.ShowHelp(Me, HelpProvider.HelpNamespace, HelpNavigator.TableOfContents)
A better solution would be to change the name of your menu item so that it is consistent with the rest of your app and doesn't clash with the existing class. Given that you obviously have a HelpContentsToolStripMenuItem, the offender should almost certainly be named HelpToolStripMenuItem.
 

g4naq

Member
Joined
Sep 6, 2021
Messages
9
Programming Experience
1-3
You have marked this thread Resolved but you haven't specified what the solution was, so we don't know whether it's actually resolved or that was a mistake, plus no one else who has a similar problem can benefit.

Either way, it would seem that you're trying to call System.Windows.Forms.Help.ShowHelp but you have a ToolStripMenuItem named Help and so your reference to Help in that code is being interpreted as the latter rather than the former. One solution would be to qualify the type in that code, i.e.
VB.NET:
Windows.Forms.Help.ShowHelp(Me, HelpProvider.HelpNamespace, HelpNavigator.TableOfContents)
or:
VB.NET:
System.Windows.Forms.Help.ShowHelp(Me, HelpProvider.HelpNamespace, HelpNavigator.TableOfContents)
A better solution would be to change the name of your menu item so that it is consistent with the rest of your app and doesn't clash with the existing class. Given that you obviously have a HelpContentsToolStripMenuItem, the offender should almost certainly be named HelpToolStripMenuItem.
Reply
Apologies jmcilhinney I did exactly as you specified & changed the name of the menu item.
Thanks for responding..

Clive
 
Top Bottom