Solved

VB.Net - Excel Spreadsheet and MessageBox

Posted on 2013-06-07
3
412 Views
Last Modified: 2013-07-10
Good Day Experts!

I have a little application here that ouputs an Excel spreadsheet.  I have added functionality to email and save automatically.  However, I need to be able to review the figures in the spreadsheet before emailing.  So, I put a messageBox in to temprarily stop processing to remind the User to review the figures.  

Only issue I have is when the messageBox pops-up it is behind the spreadsheet.  How can I make it be in front?

Here is my code for the MessageBox:

Dim Result As DialogResult = MessageBox.Show("Review the figures on the spreadsheet. Click Yes to save/auto-email or No to re-run.", "Check Values", MessageBoxButtons.YesNo)

Thanks,
jimbo99999
0
Comment
Question by:Jimbo99999
[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
3 Comments
 
LVL 1

Accepted Solution

by:
jay813 earned 250 total points
ID: 39230776
You could create a form that looks like a message box, change its .topmost property to true. That way you could also customize your buttons to say "Email" rather than having a yes/no dialog. Just some food for thought..
0
 
LVL 10

Assisted Solution

by:adriankohws
adriankohws earned 250 total points
ID: 39231061
Yes, like what jay813 said, you can do that. Otherwise you have to write your own class message box so that you have topmost property to use.

There's also one way to try, make sure your application is on focus before calling the messagebox. Messagebox is not the topmost only when your application has actually lost focus. (Maybe the Excel application is focus during that time).

Actually if you were to ask me, I found the flow a bit weird. You should try to consider other flow, for example, inform the user before Excel even started, just a recommendation...
0
 

Author Comment

by:Jimbo99999
ID: 39239307
Thanks for the feedback, I will try it.  

Previous flow was to generate the report.  I had to look at the figures on the report and if all the checks matched then we were good.  If they did not match I had to figure out in db why then repair and re-run report. Once report is good then it is emailed in Outlook.

Now we want to auto email it through the program in event we forget to manually do it in Outlook.  So I was using the messageBox to temporarily stop code execution to review the figures.  If figures match I hit continue on the messageBox and the program sends email.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

751 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