Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: Antichrist on August 24, 2004, 04:58 PM

Title: VB.Net Menu Help (Solved)
Post by: Antichrist on August 24, 2004, 04:58 PM
I've got my menu completed, and now I'm working on the code. I've tried many things, and I'm not exactly sure what to do. I'm trying to simply get it so when you go to Help | About, the About window shows.. My About window is named frmAbout.vb I've tried Show(frmAbout) but it wants me to declare frmAbout, i declared it as a String, and it tells me "To many arguements to "Public Sub Show()" and i made it Private Sub, so idk where the Public Sub comes from. I admit I'm a newbie, and I probably shouldnt even be trying to make a bot yet, but I'm trying to learn as I go.
Title: Re:VB.Net Menu Help
Post by: UserLoser. on August 24, 2004, 05:03 PM
Note the name of this forum is Battle.net Bot Development.  Not .NET Platform.  And if you're a newbie, I'd suggest not writing a Battle.net binary bot.
Title: Re:VB.Net Menu Help
Post by: MyndFyre on August 24, 2004, 05:10 PM
Quote from: Antichrist on August 24, 2004, 04:58 PM
I've got my menu completed, and now I'm working on the code. I've tried many things, and I'm not exactly sure what to do. I'm trying to simply get it so when you go to Help | About, the About window shows.. My About window is named frmAbout.vb I've tried Show(frmAbout) but it wants me to declare frmAbout, i declared it as a String, and it tells me "To many arguements to "Public Sub Show()" and i made it Private Sub, so idk where the Public Sub comes from. I admit I'm a newbie, and I probably shouldnt even be trying to make a bot yet, but I'm trying to learn as I go.

This thread ought to be moved to the .NET Platform Forum.
[
Antichrist, if you're familiar with VB, you'll find a lot of things are different in VB .NET.  I suggest that you learn that first.
Title: Re:VB.Net Menu Help
Post by: hismajesty on August 24, 2004, 05:15 PM
That's becuase you can't reference it directly. Take for example this code:


Dim aShow As New frmAbout
aShow.Show()


Or, if you're using the 2005 beta, you can just do this.
My.Forms.frmAbout.Show()

Title: Re:VB.Net Menu Help
Post by: Antichrist on August 24, 2004, 05:17 PM
oh yes, i keep forgeting about the .net platform forum, im sorry. thanks for the help, ill prolly learn more before i continue.
Title: Re:VB.Net Menu Help
Post by: hismajesty on August 24, 2004, 08:12 PM
Quote from: Antichrist on August 24, 2004, 05:17 PM
oh yes, i keep forgeting about the .net platform forum, im sorry. thanks for the help, ill prolly learn more before i continue.

So, it's working now?
Title: Re:VB.Net Menu Help
Post by: Antichrist on August 25, 2004, 04:00 PM
Quote from: hismajesty[yL] on August 24, 2004, 08:12 PM
So, it's working now?

No it's not. My About form is called: About.vb
I took your code and put this:


Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
       Dim aShow As New About
       aShow.Show()
   End Sub


and it says Type 'About' is not defined. By the way. I'm using Version 2003.
Title: Re:VB.Net Menu Help
Post by: Banana fanna fo fanna on August 25, 2004, 04:30 PM
Alright, let's try figuring this out on our own, shall we?

Look at the error message. It doesn't know what the name "About" means. This means:

- You spelled it wrong somewhere
- It's not in the current namespace

How do we bring something into the current namespace? I think, in vb.net, it's Imports.

There are your hints.
Title: Re:VB.Net Menu Help
Post by: MyndFyre on August 25, 2004, 04:50 PM
Or maybe by using the correct identifier...
Title: Re:VB.Net Menu Help
Post by: Antichrist on August 26, 2004, 11:44 AM
Ah! In the Solution Explorer it was reading as 'About' but I went into the Class View, and it was Form3. I tried it out just to see what would happen, and now it works beautifully. For future use to all those with the same problem this is what I have:


Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
       Dim About As New Form3
       About.Show()
   End Sub
Title: Re:VB.Net Menu Help
Post by: MyndFyre on August 26, 2004, 12:51 PM
Quote from: Antichrist on August 26, 2004, 11:44 AM
Ah! In the Solution Explorer it was reading as 'About' but I went into the Class View, and it was Form3. I tried it out just to see what would happen, and now it works beautifully. For future use to all those with the same problem this is what I have:

Yes, forms are not necessarily the same name as the file.  Within the file is a declaration "Public Class Form3 Inherits System.Windows.Forms.Form".  The term Form3 (or something similar) is the identifier of the form, not the name of the file that contains it.