.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Textbox accepts only 0 to 24 numbers!

Posted By: Murali     Posted Date: December 16, 2011    Points:5   Category :ASP.Net
Hi,

I'm using .net 4.0 with C#. In text box when we enter numbers that text box accept only below 24 numbers!( If we enter 25,26,27... these numbers will no display in that text box) , at the same time that text box accepts two decimals only (Ex: 12:00,1:00.....).

It is possible to do this? Can any one pls help me !!

Responses
Author: Narayanan             
Posted Date: December 19, 2011     Points: 20   

Hi Murali,
Declaration Part
int[] idx = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 };
Button_Click Event:
int search_Key = Int32.Parse(txtInput.Text);
int chk_value = SearchText(idx, search_Key);
if (chk_value == -1)
{
txtInput.Text = "";
}
Method:
private static int SearchText(int[] arry,int key)
{

for (int idxs=0;idxs < arry.Length;idxs++)
{
if (arry[idxs] == key)
{
return idxs;
}

}
return -1;
}
Note: It is a windows Application.


Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend