• 0

Newbie C# wants to know how to call Aboutbox


Question

Hi. I am very new to the C# programming language. I am using Microsoft Visual C# 2005 Express Edition that came on the PC Authority magazine cover discs.

I have followed a tutorial bundled with the program on how to build a simple web-browser and I have succeed. Now I am building on from it to add more basic features and has succeeded. See screenshot below.

I am now in the stage of attempting to bundle an About Box to my web browser. I have a About Box ready to go but how do I call it when I click About > About Robo Browser.

I have also attached the code of the main form (the web brower) for any of you to look at. I just wanted to know what the code is to call the About Box which is called AboutBox1.cs in my project. I did search all help sources, but they did not provide much help on how to call it.

robobrowser.jpg

Edited by mr.roberts

4 answers to this question

Recommended Posts

  • 0
  mr.roberts said:
Hi. I am very new to the C# programming language. I am using Microsoft Visual C# 2005 Express Edition that came on the PC Authority magazine cover discs.

I have followed a tutorial bundled with the program on how to build a simple web-browser and I have succeed. Now I am building on from it to add more basic features and has succeeded. See screenshot below.

I am now in the stage of attempting to bundle an About Box to my web browser. I have a About Box ready to go but how do I call it when I click About > About Robo Browser.

I have also attached the code of the main form (the web brower) for any of you to look at. I just wanted to know what the code is to call the About Box which is called AboutBox1.cs in my project. I did search all help sources, but they did not provide much help on how to call it.

robobrowser.jpg

586047719[/snapback]

Probably something like:

AboutBox1 AboutMe = new AboutBox1();
AboutMe.Show();

I'd have to look at the project, but that should work if the class name is AboutBox1; if not then just plug in the class name.

That was hard for me to grasp when moving from VB6 to C#. In VB6, it would create a form's "default instance" if you called it without instantiating it first. .NET doesn't do that; so you have to create a new instance for each form you use.

  • 0

I assume your about box class is called 'AboutBox'. If so, for the menu event handler write

  AboutBox ab = new AboutBox();
  ab.ShowDialog();

This will also work:

  new AboutBox().ShowDialog();

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.