[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Yes No Messagebox

Posted on 2004-10-13
2
Medium Priority
?
285 Views
Last Modified: 2010-04-24
Using the code below, how can I default the focus to the No instead of to the Yes option on the messagebox when it opens?

Dim msg As String = "All data will be permanently lost." & vbCrLf & "Are you sure you want to delete the data file?"
        If MessageBox.Show(msg, "Deleting Data File", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) = DialogResult.Yes Then
            NumericUpDown1.Focus()
            If File.Exists(fileName) Then
                File.Delete(fileName)
                MsgBox("File Deleted", MsgBoxStyle.Information, "Delete Data File")
                analyzeNumbers()
            End If
        End If
0
Comment
Question by:teamdad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 12302212
Like this (note the extra parameter after MessageBoxIcon.Warning) :

        Dim msg As String = "All data will be permanently lost." & vbCrLf & "Are you sure you want to delete the data file?"
        If MessageBox.Show(msg, "Deleting Data File", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) = DialogResult.Yes Then
            NumericUpDown1.Focus()
            If File.Exists(fileName) Then
                File.Delete(fileName)
                MsgBox("File Deleted", MsgBoxStyle.Information, "Delete Data File")
                analyzeNumbers()
            End If
        End If
0
 

Author Comment

by:teamdad
ID: 12302300
Thanks again Idle_Mind for the help.  I learn better from doing and seeing than reading and then trying to apply what I read.  It's tough learning as you go like this but it's best for me.  I have another question on doing a file backup if you would like to check it out too.  It's at the link below.

http://experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21167308.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question