Only numeric “.” and “-” acceptable in textbox using c#

June 16, 2010

using System.Text.RegularExpressions;

private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
{
e.Handled = !IsTextAllowed(e.Text);
}
private static bool IsTextAllowed(string text)
{
Regex regex = new Regex(“[^0-9.-]“);
return !regex.IsMatch(text);
}

//use above code in textbox “PreviewTextInput” EVENT


Textbox behavior like TAB and Shift + Tab as Enter and Shift + Enter in C#

June 16, 2010


using System.Text.RegularExpressions;

private void AllTextBoxes_KeyUp(object sender, KeyEventArgs e)
{
try
{
if (e.Key == Key.Enter)
{
e.Handled = true;
KeyEventArgs eInsertBack = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, 0, Key.Tab);
eInsertBack.RoutedEvent = UIElement.KeyDownEvent;
InputManager.Current.ProcessInput(eInsertBack);
}
}
catch
{
//code for any error logging!
}

Assign above in textbox EVENT on “KeyUp” event

good luck


How to execute .wmv file into a web page?

January 23, 2010
 
<embed type=”application/x-mplayer2″ pluginspage=”http://www.microsoft.com/Windows/MediaPlayer/” name=”mediaplayer1″ ShowStatusBar=”true” EnableContextMenu=”false” autostart=”true” loop=”false” src=”VideoFile.wmv” />
 
Also you can enhance more with following parameters
 
<OBJECT CLASSID=”CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6″ width=”320″ height=”240″>

   <PARAM VALUE=”VideoFile.wmv”>

   <PARAM VALUE=”True”>

   <PARAM VALUE=”False”>

   <PARAM value=”3″>

   <PARAM value=”50″>

   <PARAM VALUE=”0″>

   <PARAM VALUE=”1.0″>

   <PARAM VALUE=”False”>

   <PARAM VALUE=”False”>

   <PARAM value=”full”>

</OBJECT>


Is WiFi bad for health?

December 21, 2009
People throw the term radiation around like we are talking about a nuclear reactor core or something like that- wifi uses a band of the electromagnetic spectrum that has approximately 1 million times less energy per photon than light “radiation” does.
In these frequency bands it is strongly absorbed by water which humans are more than half composed of- all this does is warm up tissue- it can not damage DNA because it cannot break chemical bonds readily.
If you really want to avoid cancer, exercise, eat right and stay away from smoking and drinking and above all open a damn book once in a while and read this fear-mongering compounded by ignorance has got to stop.

Microsoft launch VS 2010 beta – What is new* in it?

November 12, 2009
  • New prototyping, modeling, and visual design tools enable you to create innovative applications for Windows and the Web
  • Create a shared vision as a foundation for creativity with SketchFlow ,in Microsoft Expression® Studio , and Team Foundation Server
  • Take advantage of new opportunities & capabilities offered by multi-core programming and cloud development tools

Follow

Get every new post delivered to your Inbox.