473,396 Members | 2,023 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,396 software developers and data experts.

Help With Code

Hi!

I've been cruising right along with Sams VB.NET book (24 Hour) and typed in
some code exactly as it should be and it is giving me errors..can anyone
help me troubleshoot it? It deals with the QUIT event but here is the entire
code:

Private Sub mnuQuit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles mnuQuit.Click

If mnuAskBeforeClosing.Checked Then

MessageBox.Show("Do you wish to eixt?", "Menus", _

MessageBoxButtons.YesNo) = DialogResult.No Then

Exit Sub

End If

Me.Close()

End Sub

Private Sub mnuAskBeforeClosing_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles mnuAskBeforeClosing.Click

mnuAskBeforeClosing.Checked = Not (mnuAskBeforeClosing.Checked)

End Sub


Nov 21 '05 #1
3 1005

Your If statements aren't nested correctly. Try this:

If mnuAskBeforeClosing.Checked Then

'ADD AN IF HERE
If MessageBox.Show("Do you wish to eixt?", "Menus", _
MessageBoxButtons.YesNo) = DialogResult.No Then

Exit Sub

'AND CLOSE THE BLOCK HERE
End If
End If
Me.Close()
End Sub

"Brian" <br***********@yahoo.com> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
: Hi!
:
: I've been cruising right along with Sams VB.NET book (24 Hour) and
: typed in some code exactly as it should be and it is giving me
: errors..can anyone help me troubleshoot it? It deals with the QUIT
event
: but here is the entire code:
:
: Private Sub mnuQuit_Click(ByVal sender As System.Object, ByVal e As
: System.EventArgs) Handles mnuQuit.Click
:
: If mnuAskBeforeClosing.Checked Then
:
: MessageBox.Show("Do you wish to eixt?", "Menus", _
:
: MessageBoxButtons.YesNo) = DialogResult.No Then
:
: Exit Sub
:
: End If
:
: Me.Close()
:
: End Sub
:
: Private Sub mnuAskBeforeClosing_Click(ByVal sender As System.Object,
: ByVal e As System.EventArgs) Handles mnuAskBeforeClosing.Click
:
: mnuAskBeforeClosing.Checked = Not (mnuAskBeforeClosing.Checked)
:
: End Sub
:
:
:
:


Nov 21 '05 #2
Thanks..I will give it a try..maybe the book had a typo..I am still a newbie
to have seen the problem...
"_AnonCoward" <ab*@xyz.com> wrote in message
news:Ih*******************@twister.southeast.rr.co m...

Your If statements aren't nested correctly. Try this:

If mnuAskBeforeClosing.Checked Then

'ADD AN IF HERE
If MessageBox.Show("Do you wish to eixt?", "Menus", _
MessageBoxButtons.YesNo) = DialogResult.No Then

Exit Sub

'AND CLOSE THE BLOCK HERE
End If
End If
Me.Close()
End Sub

"Brian" <br***********@yahoo.com> wrote in message
news:e1**************@TK2MSFTNGP10.phx.gbl...
: Hi!
:
: I've been cruising right along with Sams VB.NET book (24 Hour) and
: typed in some code exactly as it should be and it is giving me
: errors..can anyone help me troubleshoot it? It deals with the QUIT
event
: but here is the entire code:
:
: Private Sub mnuQuit_Click(ByVal sender As System.Object, ByVal e As
: System.EventArgs) Handles mnuQuit.Click
:
: If mnuAskBeforeClosing.Checked Then
:
: MessageBox.Show("Do you wish to eixt?", "Menus", _
:
: MessageBoxButtons.YesNo) = DialogResult.No Then
:
: Exit Sub
:
: End If
:
: Me.Close()
:
: End Sub
:
: Private Sub mnuAskBeforeClosing_Click(ByVal sender As System.Object,
: ByVal e As System.EventArgs) Handles mnuAskBeforeClosing.Click
:
: mnuAskBeforeClosing.Checked = Not (mnuAskBeforeClosing.Checked)
:
: End Sub
:
:
:
:

Nov 21 '05 #3
What errors are you getting?
Nov 21 '05 #4

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

Similar topics

4
by: PHPkemon | last post by:
Hi there, A few weeks ago I made a post and got an answer which seemed very logical. Here's part of the post: PHPkemon wrote: > I think I've figured out how to do the main things like...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
6
by: Mark Reed | last post by:
Hi all, I am trying to learn a little about programming (I know next to nothing so far) and have found some code which hides the toolbars. However, this bit of code is a little too effective and...
4
by: dixie | last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I have just installed HTML Help in an application. I told it in the Project Properties the path to the help file. I then...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
3
by: inkexit | last post by:
I need help figuring out what is wrong with my code. I posted here a few weeks ago with some code about creating self similar melodies in music. The coding style I'm being taught is apparently a...
1
by: glenn123 | last post by:
Hi, i am just about out of time to produce a working jukebox which has to perform these functions: to play music files when a track is chosen from a list which when the user presses the change genre...
10
by: JonathanOrlev | last post by:
Hello everybody, I wrote this comment in another message of mine, but decided to post it again as a standalone message. I think that Microsoft's Office 2003 help system is horrible, probably...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.