Click here to Skip to main content
15,896,915 members
Please Sign up or sign in to vote.
1.50/5 (2 votes)
See more:
In a Button click event i want to invoke the "Tab" or "Space" automatically with out pressing tab or space from keyboard ..how can i achieve this task pls help me out..thank u

Rewrite: Want to be able to monitor text in a control, and simulate a tab when the contents match a particular criteria.
Posted
Updated 23-Mar-12 5:41am
v2
Comments
Sergey Alexandrovich Kryukov 23-Mar-12 0:50am    
Not clear. Invoke for what control? Why in the event handle of the button (for which "Space" works as Click invocation)? Why at all?
--SA
[no name] 23-Mar-12 1:02am    
Can you elaborate more what actually you want to achieve? What kind of tab or space you want automatically invoke?

As stated by others you need to be more clear. Maybe what you want is to allow the user to enter text in a when certain information is complete, more onto the next control? I that is what you are trying to do, then you can monitor the user keystrokes with the KeyUp event (if you want to stop input you would monitor the KeyDown and then cancel KeyPress), and when has completed, do a SetFocus on another control.
 
Share this answer
 
Comments
jjjjjjjjjjjssssssssssssaaaaaaaaaa 23-Mar-12 11:04am    
Ya sir i have a textbox1 once i press tab some calculations are going on in that textbox1.so i wanna perform that calculation without pressing tab from keyboard in button click i wanna perform calculation so manually i wanna invoke tab in button click.pls help me sir thankss
You can monitor the text changed event: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.textchanged.aspx[^] and then use the textBox1.Focus() to put the focus on the next cell. You can also change the value of the textbox, but remember you may want to change the SelStart and SelLength which determine selected characters in the textbox.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900