Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:15:33+00:00 2026-06-05T05:15:33+00:00

I am using the following code to read an email address from a DataGridView

  • 0

I am using the following code to read an email address from a DataGridView then create an Outlook email. This works perfectly, except that the new email is set as topMost and/or opened as a dialog window, meaning I cannot click or do anything else in Outlook while the new email window is open. This is problematic if I’ve got my new email open and I was trying to search or look up something back in my inbox. Also my application will not respond (is locked) until I close or send the email.

Is there a way to create a new email and still allow regular functionality? If I click the new email button from Outlook itself, I can have as many of these open as I want, use searching, etc.

The this.TopMost = false line is to hide my WinForms app and display the new email window in front.

try
{

      string emailString = resultsGrid[resultsGrid.Columns["Email"].Index, resultsGrid.SelectedCells[resultsGrid.Columns["Email"].Index].RowIndex].Value.ToString();

    if(emailString.Contains("mailto:"))
    {
        emailString = emailString.Replace("mailto:", "");
    }

    this.TopMost = false;

    // Create the Outlook application by using inline initialization.
    Outlook.Application oApp = new Outlook.Application();

    //Create the new message by using the simplest approach.
    Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
    oMsg.Subject = "";
    oMsg.To = emailString;
    oMsg.Body = "";
    oMsg.Display(true);


    oMsg = null;
    oApp = null;
}
catch (Exception ex)
{
    MessageBox.Show(string.Format("An error occurred: {0}", ex.Message));
}

What’s also weird is if I write some stuff in the email and close it, I can save it. If I do this, when I open the email back up, it returns to it’s locked state. I’m beginning to think this has something to do with how the email was created, so some setting or attribute is getting applied and saved with it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:15:34+00:00Added an answer on June 5, 2026 at 5:15 am

    Try replacing this line:

    oMsg.Display(true);
    

    …with:

    oMsg.Display(false);
    

    Per the MailItem.Display documentation, the parameter’s name is Modal, and should be specified as:

    True to make the window modal. The default value is False.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the following code to read from stdin int size; int bufferSize=2000; char
Im using the following code to read to consumer_key and consumer_secret from config.php, pass
I am using following code to read text from a .txt file. But I
I'm using the following code to read an xml from my server and its
I'm using the following code to read a map of type HashMap<String, String >
I'm using the following code to read an XML file - var xmlhttp; if
I am using the following code to read and combine number of texts in
I'm using the following code to read a RSS feed. The problem is that
When I using the following code to read file: lines=file(data.txt).read().split(\n) I have the following
I am using following code to append param to url. This is working fine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.