473,322 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Toolbar, tabcontrol and switch (x) select statement

JH
I got a toolbar with four toolbarButtons. Moreover I have a tabcontrol with
four tabpages. For each toolbarbutton click,I want a specific tabpage to
show. But I am having a problem even when I use the show(), focus() or
BringTofront() methods.
Please somebody see the simple code below and find where I am getting it all
wrong.
Thanks

private void tbrMain_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)

{

string x = e.Button.ImageIndex.ToString();

switch(x)
{
case "2":

// this.tabControl1.TabPages[0].Show() ;

// this.tabControl1.TabPages[0].Focus();

this.tabControl1.TabPages[0].BringToFront();
break;
case "3":
//MessageBox.Show("second ");

//this.tabControl1.TabPages[1].Show();
this.tabControl1.TabPages[1].BringToFront();
break;
case "4":
//tabControl1.TabPages[2].Show() ;

this.tabControl1.TabPages[2].BringToFront();
break;

case "11":

this.tabControl1.TabPages[3].BringToFront();
break;

default:

break;
}


Nov 16 '05 #1
1 5045
JH
I got it. I should have done the following code. And it works fine now.

this.tabControl1.SelectedTab = this.tabPage2 ;

"JH" <yh*******@yahoo.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
I got a toolbar with four toolbarButtons. Moreover I have a tabcontrol with four tabpages. For each toolbarbutton click,I want a specific tabpage to
show. But I am having a problem even when I use the show(), focus() or
BringTofront() methods.
Please somebody see the simple code below and find where I am getting it all wrong.
Thanks

private void tbrMain_ButtonClick(object sender,
System.Windows.Forms.ToolBarButtonClickEventArgs e)

{

string x = e.Button.ImageIndex.ToString();

switch(x)
{
case "2":

// this.tabControl1.TabPages[0].Show() ;

// this.tabControl1.TabPages[0].Focus();

this.tabControl1.TabPages[0].BringToFront();
break;
case "3":
//MessageBox.Show("second ");

//this.tabControl1.TabPages[1].Show();
this.tabControl1.TabPages[1].BringToFront();
break;
case "4":
//tabControl1.TabPages[2].Show() ;

this.tabControl1.TabPages[2].BringToFront();
break;

case "11":

this.tabControl1.TabPages[3].BringToFront();
break;

default:

break;
}

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Scott C. Reynolds | last post by:
In VB6 you could do a SELECT CASE that would evaluate each case for truth and execute those statements, such as: SELECT CASE True case x > y: dosomestuff() case x = 5: dosomestuff() case y >...
3
by: pgraeve | last post by:
I am a convert from VB to C# so bear with me on this "conversion" question C# switch statement seems to be the closest relative to VB's Select Case. I used VB's Select Case statement liberally. ...
3
by: cdj | last post by:
Hi all, I've got a tabControl, initially with one tabPage, along with two buttons, one to add another tabPage, and one to delete the current (selected) tabPage. On each tabPage, when it is...
3
by: Henry Wu | last post by:
Hi, NumericUpDown control has a InterceptArrowKeys property, is there such a thing for a TabControl? I want to prevent the TabPages from switching to one another when the Left & Right arrow keys...
2
by: able | last post by:
Dear friends I have added an icon to the toolbar. The icon is excellent in preview but in the toolbar it displays with poor quality. Do somebody know what may cause the lower quality in...
2
by: Aspnot | last post by:
I have a TabControl that is on a form that is bound to a DataSet. I bind the dataset to the form in the Form_Load event. The TabControl has 2 TabPages. The first TabPage contains a button and a...
4
by: Jason Rangle | last post by:
I am not sure how to use this even properly. When I have it as follows I have to click on the tabPage1 for anything to show. TIA. namespace TabLayout { public partial class TabLayout : Form...
2
osward
by: osward | last post by:
Hello there, I am using phpnuke 8.0 to build my website, knowing little on php programing. I am assembling a module for my member which is basically cut and paste existing code section of...
2
by: =?Utf-8?B?TW9oc2luIEtoYW4=?= | last post by:
Hi, I am working on a website where i am creating Horizontal Menus Dynamically from database as per rights available to the user. I have several UserControls. And the Menu control also brings...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.