.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 >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

how we retrieve data on tab pressing Win App

Posted By: Sunil     Posted Date: October 31, 2008    Points:2   Category :Windows Application
i want to retrieve data on pressing Tab keyboard button,

Look my code here,

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == '\r' || e.KeyChar == '\t')
{
Class1 cls1 = new Class1();
textBox2.Text = cls1.EmpName(textBox1.Text);
}
}

here when we pressing Enter button code is working But in case of Tab not working

how we retrieve data on tab pressing

in C#.NET win app

Responses
Author: Rahul             
Posted Date: October 31, 2008     Points: 5   

I think you should call in "Enter" Event or "Leave" of TextBox

eg

private void maskedTextBox1_Enter(object sender, EventArgs e)
{
MessageBox.Show("Enter");
}


Hope this helps

Author: Naim Khan             
Posted Date: January 06, 2009     Points: 5   

well if u r retrive data from the database then u should be create a conection and retrive the data from the data base . or u can use use tab event also use in that .

hope u understand.

Naim Khan


Software Developer
khan.naim786@yahoo.com
khan.naeem1987@gmail.com
Author: Santosh             
Posted Date: October 18, 2009     Points: 5   

hi sunil
plz follow below code

VB.NET Code
Protected Overrides Function ProcessTabKey(ByVal TrueValue As Boolean) As Boolean
MyBase.ProcessTabKey(TrueValue)
MessageBox.Show("User Clicked Tab Key", "Santosh Test", MessageBoxButtons.OK, MessageBoxIcon.Information)
MsgBox("Tab key was pressed!")
'Write ur Code Here
End Function

C#.NET Code
protected override bool ProcessTabKey(bool TrueValue)
{
base.ProcessTabKey(TrueValue);
MessageBox.Show("User Clicked Tab Key", "Santosh Test", MessageBoxButtons.OK, MessageBoxIcon.Information);
MessageBox.Show("Tab key was pressed!");
//Write ur Code Here
return false;
}


i think above code solve ur problem???
Regards
Santosh



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