Click here to Skip to main content
13,052,956 members (61,865 online)
Rate this:
Please Sign up or sign in to vote.
Is Anyone tell me how to read Messagebox or AlertBox content in .net
I don't want HeaderText. I need Content of AlertBox or MessageBox.

Thank you in Advance
Posted 24-May-13 0:32am
Arun Vasu2.1K
Updated 28-May-13 1:31am
Prasad Khandekar 24-May-13 6:45am
Hello Arun,

You can use Windows API for this purpose. Please see this MSDN documentation ( Also look at the ManageSpy code sample ( or have a look at this link (

Arun Vasu 24-May-13 7:11am
i refer all site which you gave me.. but sorry.. i not find any exact solution
Prasad Khandekar 24-May-13 7:32am
What you are really trying to do is called screen scraping. The sites I referred contains information on how to do this. Basically AlerBox or a MessageBox are windows and you need to retrieve the text present in one of the labels of that window. The typical steps to do this are
1. Find the matching window (by say title)
2. Get a list of child controls
3. Go through each and get the text content if supported.

This is one more link (
ryanb31 28-May-13 9:01am
Can you explain why so that we can understand how to help properly?
Arun Vasu 31-May-13 1:23am
My need is:
I have one web application. After One process a page shows one message box, it may successfully inserted, or updated or its return guid() value or if any exception in process it will show in that application. My requirement is i want to read that message box content using that i need to take some action. for this i need the solutions.

ryanb31 31-May-13 7:33am
Are you sure it is an alert() from javascript? If so, you'll have to do what Prasad suggested, use the Windows API to get a handle on that window. I doubt that will be easy. Or, could it be a div that is displayed? Either way, it sounds like a hack to get this to work. Is there no other way to do it? You can't have the person who created the website create a webservice for you?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 28 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100