I am developing a Windows Form Application with several pages. I am using a TabControl to implement this. Instead of using the header to switch between tabs, I want my application to control this e.g. the next tab should open after the user has filled in a text box and clicked the next button.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. It shows the tabs at design time so you can easily switch between them while designing. They are hidden at runtime, use the SelectedTab or SelectedIndex property in your code to switch the page.
If you really want to do this, yo can do something like this
Where
tcActionControls
is yourTabControl
andtbPageToShow
is aTabPage
to show in this precise moment.Should work for you.
Regards.
You can try removing the TabPage from the TabPageCollection :
TabControl.TabPageCollection tabCol = tabControl1.TabPages;
I was needing this code but in VB.net so I converted it. If someone needs this code in VB.Net there it is
and thanks to @Hans Passant for the answer in C#
You can replace tabcontrol with a hand made panel that mimic like you want:
And then add pages and set current visible page: