Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB.Net - Excel Spreadsheet and MessageBox

Posted on 2013-06-07
3
Medium Priority
?
429 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 1000 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 1000 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

Technology Partners: 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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

971 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