|
// IIsAdmin.NET
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This softwareis provided "AS IS" with no warranties of any kind.
// The entire risk arising out of the use or performance of the software
// and source code is with you.
//
// THIS NOTICE MAY NOT BE REMOVED FROM THIS FILE.
using System;
using System.Windows.Forms;
using System.Globalization;
namespace IIsAdmin
{
/// <summary>
/// Summary description for ExceptionUtilities.
/// </summary>
public class ExceptionUtilities
{
public static void DisplayException(Exception ex)
{
MessageBox.Show("An error occurred, in most cases performing an IIsReset will correct any issues. Below are the details of the exception:\n\n" + ex.ToString(), "Exception Encountered", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static void DisplayValidation(string message)
{
MessageBox.Show(message, "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
public static bool IsNumeric(string expression)
{
bool hasDecimal = false;
for(int i=0;i<expression.Length;i++)
{
if(expression[i] == '.')
{
if(hasDecimal)
{
return false;
}
else // 1st decimal
{
// inform loop decimal found and continue
hasDecimal = true;
continue;
}
}
// check if number
if(!char.IsNumber(expression[i]))
{
return false;
}
}
return true;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Senior Application Developer specializing in Windows desktop and network development.
Professional Experience
- B.S. of Computer Science (Graduated 2001 - PSU)
- Senior Application Developer (8+ yrs)
- Microsoft Certified Professional
Primary Interests
- C#, C++, HTML, Javascript
- XML, ASP.NET, Web Services, SOAP, UDDI
- Socket programming and anything network related
- Reflection, Serialization, and Plugin Frameworks
- Owner-drawn controls and GDI+ goodness