View Single Post
  #2 (permalink)  
Old April 24th, 2014, 01:03 AM
mmorgan30 mmorgan30 is offline
Friend of Wrox
 
Join Date: Feb 2014
Posts: 136
Thanks: 1
Thanked 10 Times in 10 Posts
Default

MessageBox is a windows form control. Visual web developer is for web forms. Rendering happens on the client machine; so the message box does not work. Looking at your snippet you are wanting to report some error to back to the users browser. What i typically do for this is to have a custom validator that sits silently on the page and set it up so it does not have text and its display is none. Along with this validator you add a validation summary to the page. To activate the error reporting in your try catch block set the IsValid property to false and the ErrorMessage property to your exception message on the custom validator.

Sample code to set error message on screen
Code:
catch ex as Exception
  custvalException.IsValid = false
  custValException.ErrorMessage = "some message" 'ErrorMessage displays in validation summary
End try

Last edited by mmorgan30; April 24th, 2014 at 01:12 AM..
Reply With Quote
The Following User Says Thank You to mmorgan30 For This Useful Post:
belitaross (April 24th, 2014)