473,320 Members | 2,000 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

aboutbox

cj
I had found some code I used in VB2005 to show an about box. The about
box itself was just a windows form with a button on it. The button had
no code behind it but it's dialogresult property is set to cancel. The
help about menu item showed the form like this:

Private Sub AboutToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AboutToolStripMenuItem.Click
Try
Dim myAboutDialog As New About
myAboutDialog.ShowDialog()
If myAboutDialog.DialogResult =
System.Windows.Forms.DialogResult.OK Then
myAboutDialog.Dispose()
End If
Catch ex As Exception
System.Console.WriteLine(ex.Message.ToString())
End Try
End Sub

I'm playing with VB2008 now and I was dupliating this application in
2008 and I noticed it has an about box template form to use. I notice
it's ok button had the code me.close behind it.

Can anyone tell me which way I should do this in 2008?

Should I still call the form by saying

Private Sub AboutToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AboutToolStripMenuItem.Click
Try
Dim myAboutDialog As New AboutBox1
myAboutDialog.ShowDialog()
If myAboutDialog.DialogResult =
System.Windows.Forms.DialogResult.OK Then
myAboutDialog.Dispose()
End If
Catch ex As Exception
System.Console.WriteLine(ex.Message.ToString())
End Try
End Sub

What are the differences in how the about form is being handled?
Jun 27 '08 #1
2 3214
On May 13, 4:28*pm, cj <c...@nospam.nospamwrote:
I had found some code I used in VB2005 to show an about box. *The about
box itself was just a windows form with a button on it. *The button had
no code behind it but it's dialogresult property is set to cancel. *The
help about menu item showed the form like this:
Just how did the About form close if the OK button's Click event
handler had no code?
>
* * *Private Sub AboutToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AboutToolStripMenuItem.Click
* * * * *Try
* * * * * * *Dim myAboutDialog As New About
* * * * * * *myAboutDialog.ShowDialog()
* * * * * * *If myAboutDialog.DialogResult =
System.Windows.Forms.DialogResult.OK Then
* * * * * * * * *myAboutDialog.Dispose()
* * * * * * *End If
* * * * *Catch ex As Exception
* * * * * * *System.Console.WriteLine(ex.Message.ToString())
* * * * *End Try
* * *End Sub

I'm playing with VB2008 now and I was dupliating this application in
2008 and I noticed it has an about box template form to use. *I notice
it's ok button had the code me.close behind it.
FYI, VS2005 also had an About form template.
>
Can anyone tell me which way I should do this in 2008?

Should I still call the form by saying

* * *Private Sub AboutToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AboutToolStripMenuItem.Click
* * * * *Try
* * * * * * *Dim myAboutDialog As New AboutBox1
* * * * * * *myAboutDialog.ShowDialog()
* * * * * * *If myAboutDialog.DialogResult =
System.Windows.Forms.DialogResult.OK Then
* * * * * * * * *myAboutDialog.Dispose()
* * * * * * *End If
* * * * *Catch ex As Exception
* * * * * * *System.Console.WriteLine(ex.Message.ToString())
* * * * *End Try
* * *End Sub

What are the differences in how the about form is being handled?
IMHO, there is no reason to check the dialogresult from an about form.
In the code you have, all it does is dispose of the form object if the
dialog result is OK. Why not just let the garbage collector handle the
object's disposition? All you really need to do is instantiate the
form object and show the form, again, IMHO.
Jun 27 '08 #2
<za***@construction-imaging.comschrieb
On May 13, 4:28 pm, cj <c...@nospam.nospamwrote:
I had found some code I used in VB2005 to show an about box. The about
box itself was just a windows form with a button on it. The button had
no code behind it but it's dialogresult property is set to cancel. The
help about menu item showed the form like this:
Just how did the About form close if the OK button's Click event
handler had no code?

====

By pushing the button, the Form's dialogresult property is set
automatically because the button's dialogresult property is set. In
addition, as soon as the property is set, the Showdialog function
returns. Therefore it works without writing additional code.

Armin

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: RJ | last post by:
Hi, I've been going over the Quick Start to Client side COM and Python and many other sources, but cannot find an example that will get my com/ActiveX .ocx USB device driver imported. The Excel...
1
by: Moi | last post by:
Hello, I used AxImp on one ActiveX I've written (VC++6), and I'm trying to use the generated assemblies in VB. Net. it seems that the underlying ocx is not created when I'm calling the...
2
by: Billy Greening | last post by:
I have an application in C# that was written as a bunch of individual CS files. I would like to combine these all into single solution that can be editied with the Visual Studio 2003 editor. Does...
1
by: foreman | last post by:
Hello Everybody: I am trying out DialogBox, and I have been trying to press the OK Button on the dialogbox hoping I can receive the OK DialogResult to Main Form. Below is my OK button click...
4
by: c0d3r | last post by:
I need to know how to make an About Box show. The about box is name AboutBox.vb I've tried AboutBox.show() but it comes up saying: "Reference to a non-shared member requires an object...
1
by: Troy Bull | last post by:
Greetings I am trying to use a singleton to hold a group of forms. I have a MDIMaster form. I have a class called Forms; Forms is a singleton. I want to do something like the following. In...
7
by: Boki | last post by:
Hi All, It is very convenient to make a About box in C#. My problem is how to let user must to click OK to close this About box. ( user should not allow to click any other place at this time )...
2
by: =?Utf-8?B?TmV3YnJv?= | last post by:
Hi, Please bare with me as I'm starting to learn. Basically I have a mainform which get created upon program startup, and an Aboutbox form that shows itself when user click on the 'About'...
19
by: zildjian | last post by:
Hello, I have a problem. I use SWT to make GUI. In the main window I have drawed some images (canvas, gc on canvas) and pressing a button will appear a new window. When I I move the new window...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.