473,320 Members | 1,867 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,320 software developers and data experts.

Recognising a Tab click

Hey folks,

I'm new to this malarky, but I can't find anywhere an example of
programmatically recognising which tab a user has clicked.
I know it's something to do with the SelectedIndex property of the tab
object, but I can't get it into an "if" statement without it complaining.

Here's what I have...

private void fclsTabs_Load(object sender, System.EventArgs e)

{
if (this.tabControl1.SelectedIndex = 0)

txtTextBoxMain.Text = "Tab 1";

}

This complains with "Cannot implicitly convert type 'int' to 'bool' (whether
I have the "this" word in or not).

Can someone tell me what I'm doing wrong?

Thanks,

Ferg.

Nov 13 '05 #1
3 4382
Hi

ferg wrote:
Hey folks,

I'm new to this malarky, but I can't find anywhere an example of
programmatically recognising which tab a user has clicked.
I know it's something to do with the SelectedIndex property of the tab
object, but I can't get it into an "if" statement without it complaining.

Here's what I have...

private void fclsTabs_Load(object sender, System.EventArgs e)

{

// if (this.tabControl1.SelectedIndex = 0)

// try this:

if (this.tabControl1.SelectedIndex == 0)

txtTextBoxMain.Text = "Tab 1";

}

This complains with "Cannot implicitly convert type 'int' to 'bool' (whether
I have the "this" word in or not).

Can someone tell me what I'm doing wrong?


In c# (like in c, c++, java) "is equal" operator is "==" (not "=")

Marcin Grzêbski

Nov 13 '05 #2
The following syntax is wrong.
if (this.tabControl1.SelectedIndex = 0)
should be
if (this.tabControl1.SelectedIndex == 0)

Thanks
-----Original Message-----
Hey folks,

I'm new to this malarky, but I can't find anywhere an example ofprogrammatically recognising which tab a user has clicked.
I know it's something to do with the SelectedIndex property of the tabobject, but I can't get it into an "if" statement without it complaining.
Here's what I have...

private void fclsTabs_Load(object sender, System.EventArgs e)
{
if (this.tabControl1.SelectedIndex = 0)

txtTextBoxMain.Text = "Tab 1";

}

This complains with "Cannot implicitly convert type 'int' to 'bool' (whetherI have the "this" word in or not).

Can someone tell me what I'm doing wrong?

Thanks,

Ferg.

.

Nov 13 '05 #3
I feel like a real dumbass now. Thanks guys. :-)
"buddy" <bu***@onlinework.com> wrote in message
news:0e****************************@phx.gbl...
The following syntax is wrong.
if (this.tabControl1.SelectedIndex = 0)


should be
if (this.tabControl1.SelectedIndex == 0)

Thanks
-----Original Message-----
Hey folks,

I'm new to this malarky, but I can't find anywhere an

example of
programmatically recognising which tab a user has clicked.
I know it's something to do with the SelectedIndex

property of the tab
object, but I can't get it into an "if" statement without

it complaining.

Here's what I have...

private void fclsTabs_Load(object sender,

System.EventArgs e)

{
if (this.tabControl1.SelectedIndex = 0)

txtTextBoxMain.Text = "Tab 1";

}

This complains with "Cannot implicitly convert type 'int'

to 'bool' (whether
I have the "this" word in or not).

Can someone tell me what I'm doing wrong?

Thanks,

Ferg.

.

Nov 13 '05 #4

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

Similar topics

4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
1
by: zoltix | last post by:
Hi, I am beginner in JavaScript. I would like to intercept all click events on my document. I use this function for that document.onmousedown=click;. It works well. But I would like to...
7
by: Paul Cooper | last post by:
Dear All, I am working on a piece of Javascript code that needs to detect a mouse-click, shift-click and control-click. The code is not my own - it is a part of a much larger suite of routines....
11
by: Thom Little | last post by:
I would like three states on an icon ... Left Click Right Click Double Click Left Click is fired at least once on a Double Click Is there a good example that shows how to determine if the...
5
by: J McD | last post by:
Hi I have a DataGrid with an ImageButton column. When I click on an imagebutton I get a postback but it doesn't run the OnImgBtnClick method. I can actually comment out the line where I add this...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
2
by: pingalkar | last post by:
In my application, on one form i m getting information from user and save this information , after saving this information again we loading that page. (At this moment if any one try to refresh this...
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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: 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...
0
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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.