Solved

Form to always appear in the front of the worksheet (using VSTO)

Posted on 2004-09-20
3
206 Views
Last Modified: 2008-02-01
Hi Experts, I am writing a VSTO (Excel) application using VB.NET. I have an Excel worksheet as the main interface. When I double-click on the cells, I want to call up my Windows Form - frmMain. I have able to call up the form but the form always goes behind the worksheet despite of me typing frmMain.BringToFront().

In VB6, the instruction frmMain.Show vbModeless, Me will do the job. However in VB.NET, the show method accepts no argument. Please advice me on how to make this frmMain always appear in front of the Excel worksheet.

TIA.
0
Comment
Question by:bpyeo
[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 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
ID: 12108932
Try setting the TopMost property of frmMain to True.

Idle_Mind
0
 

Author Comment

by:bpyeo
ID: 12109300
Hi Idle_Mind, thanks for your advice. Now how could I ensure that the user will not pressed ALT-F4 to close this form? I have made the form not to show up in the taskbar and the form does not have any border. However the user can still close the form by pressing ALT-F4. Hope to hear from your expertise advice.

TIA.
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 400 total points
ID: 12109802
you could cancel that action in the mousedown event of the form (don't forget to set the keypreview property to true in your form)

Private Sub Form5_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.Alt = True and e.KeyCode = Keys.F4 Then
                e.Handled = True
        End If
    End Sub
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

Suggested Solutions

Title # Comments Views Activity
YouTube API get the Video Tags - vb.net 7 47
Send SMS from vb.net desktop app 30 45
Convert VB web project to C# 3 59
Trying to Create FTP Client in VB.net - getting errors 3 32
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

740 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