Solved

VB.Net - Excel Spreadsheet and MessageBox

Posted on 2013-06-07
3
404 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
3 Comments
 
LVL 1

Accepted Solution

by:
jay813 earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now