Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have one form with two tab pages I want like this when i press tab which has focus textbox on tabpage1 it should move focus to textbox on the tabpage2..

thx..
Posted
Updated 22-Dec-11 18:58pm
v2
Comments
Albert Holguin 22-Dec-11 11:13am    
You tags need to be more appropriate, what's the framework? ...or are directly interacting with an API?
Albert Holguin 22-Dec-11 11:14am    
By the way, having tab move you from one tabpage to another is not what I'd call regular operation, that's a pretty non-standard way of doing things.

on key press event..

C#
if(e.KeyCode == 9)
{
     tabcontainer1.ActiveTabIndex=2;
     txtbox2.focus();
}


hope this works..
 
Share this answer
 
Comments
Ravi Sargam 22-Dec-11 3:48am    
on which key press. karthik

on textbox1 keypress event e.keycode is not available only keychar is there
Ravi Sargam 23-Dec-11 0:55am    
Karthik is there any other way ???
Take a look at IsDialogMessage function, this is the function that will permit you to brows using TAB button

C++
while(GetMessage(&msg,0,0,0))
while(GetMessage(&msg,0,0,0))
{
   if (!IsDialogMessage(ghwnd, //for main window
&msg) && !IsDialogMessage(hViewWindow,//for one view window
 &msg) && !TranslateAccelerator( msg.hwnd //for all window i think
,haccel ,&msg))
   {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
   }
}



I build this thing in rush and not a windows programmer might found some *** let me know.. But this program works fine :)
 
Share this answer
 
Comments
Ravi Sargam 23-Dec-11 0:55am    
i'm not getting it is there any other way...
Mohibur Rashid 23-Dec-11 2:30am    
how come?
follow the link http://msdn.microsoft.com/en-us/library/eb65x3z3(v=vs.80).aspx

and also make sure you used style WS_TABSTOP on your object
Ravi Sargam 23-Dec-11 3:36am    
if i have to do it in C# then what i have to do ???
Mohibur Rashid 23-Dec-11 6:02am    
When did you change your tag?

besides I dont know.
1.just add another textbox behind txtbox1 on tabpage1
2.set tab index number of textbox if textbox1 tab index is 1 set textbox tab index to 2.
3.on Enter event of textbox transfer it to textbox2 which is on the tabpage2
 
Share this answer
 

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



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