473,569 Members | 2,590 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with tab control event

I have two tab controls (four tabpages each) and each tab control is in a
splitter panel (horiz orientation). I added a event handlers to handle the
selected tab event. The upper tab control works when every tab is selected.
The lower tab control only seems to work when the first three tabs are
selected, not the last.

Any ideas why?

Thanks,
Mark
Mar 8 '07 #1
2 8546
On Mar 7, 4:43 pm, "Mark F." <reply2gr...@no spam.comwrote:
I have two tab controls (four tabpages each) and each tab control is in a
splitter panel (horiz orientation). I added a event handlers to handle the
selected tab event. The upper tab control works when every tab is selected.
The lower tab control only seems to work when the first three tabs are
selected, not the last.

Any ideas why?

Thanks,
Mark

Mark,

I created a VS.NET 2003 WinForm project, added a panel and to the
panel a tab, a splitter (oriented as horizontally) and another tab.

I wired both tab controls to its SelectedIndexCh anged event and on
clicking each TabPage in both tabs the event fired.

I then wired the TabIndexChanged event for both tabs and found that
this event didn't fire for any TabPage for either tab. I'm not sure
why, perhaps I don't understand what the event is supposed to do
exactly.

For fun (or at least what passes for fun for me these days) I had both
tabs SelectedIndex property display when the SelectedIndexCh anged
events fired. I noticed that the SelectIndex was changing, yet
changing the index via a mouse click wasn't firing the TabIndexChanged
event.

I was going to post my project but saw that it would have been pretty
much illegible. If you're not using the SelectedIndexCh anged event
for your tab controls, perhaps that's you're solution.

-Jay

Mar 9 '07 #2
"Jay Riggs" <ja*********@gm ail.comwrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
I created a VS.NET 2003 WinForm project, added a panel and to the
panel a tab, a splitter (oriented as horizontally) and another tab.

I wired both tab controls to its SelectedIndexCh anged event and on
clicking each TabPage in both tabs the event fired.

I then wired the TabIndexChanged event for both tabs and found that
this event didn't fire for any TabPage for either tab. I'm not sure
why, perhaps I don't understand what the event is supposed to do
exactly.

For fun (or at least what passes for fun for me these days) I had both
tabs SelectedIndex property display when the SelectedIndexCh anged
events fired. I noticed that the SelectIndex was changing, yet
changing the index via a mouse click wasn't firing the TabIndexChanged
event.

I was going to post my project but saw that it would have been pretty
much illegible. If you're not using the SelectedIndexCh anged event
for your tab controls, perhaps that's you're solution.

-Jay
Thanks Jay,

I simply wanted to display the current view (tabpage) on a statusbar pane.
private void viewsTabControl _SelectedIndexC hanged(object sender, EventArgs
e)
{
sbrViewPane.Tex t = viewsTabControl .SelectedTab.Te xt;

// or ...,

// sbrViewPane.Tex t =
viewsTabControl .TabPages[viewsTabControl .SelectedIndex].Text;
}

I think that I found the trouble. One view is a picturebox control that
previews an image file if the user selects one. I used the OnPaint event to
draw text in the view if the user clicks the tab and no image is loaded (ie,
"No image selected"). When I commented out the Paint code block the
SelectedIndexCh anged event fires normally for the preview tabpage. I still
don't know why this behavior is occurring however.

Mark


Mar 10 '07 #3

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

Similar topics

1
3021
by: mjcast | last post by:
I have been working on an ActiveX control in C#. It is packaged in a Windows Control library and the code is in a user control. The control is used as an automation receiver that is used to update a page dynamically through the use of event listeners in javascript That works, the problem is that when I run the test webpage that runs the ActiveX...
11
6170
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the OnPaint . The recangle draws correct when i press the mouse, but when i release the mouse the background is not restored What should i do in the...
3
4395
by: dan | last post by:
Hi all, I have a reflection-problem I'm totally stuck with. Maybe someone has a hint... I want to get a fieldinformation of an event from the Control class, e.g. "TextChanged". FieldInfo fi = typeof(Control).GetField("TextChanged", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic |...
1
4012
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the...
1
1963
by: Lamont Adams | last post by:
Hi all, I've created numerous custom controls of varying complexity, but I've been on this problem for a day and a half, and I can't figure this mystery out. I hope one of you kind folks can point out the really obvious and stupid thing I'm overlooking here. :) I have a custom control that provides a tasklist similar to what you get in...
9
2438
by: Anders K. Jacobsen [DK] | last post by:
Hi I have this that adds some usercontrol (UCTodays.ascx) to a placeholder foreach(A a in B){ UCTodays ucline = (UCTodays )LoadControl("UCTodays.ascx"); ucline.Initializecontrol(line,alternate); Placeholder1.Controls.Add(ucline); }
14
3254
by: Altman | last post by:
Ok I have a control that is inherited from another class. In the child I put msgbox(me.name) in the load event. What always pops up is the name of the parent class and not the name of the instance of the object. WHY? Also if I can figure this out I'm hoping that I can put this in the load event of the parent and still get it to work.
1
5129
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
6
1999
by: Joel | last post by:
2 Questions: (1) The documentation says application.run() creates a standard message loop on the current thread and "optionally" shows a form. This is really confusing because I was of the understanding that application.run() creates a message loop for the form and passes all messages to it. If showing the form is optional, and I want to...
6
1842
by: Funky | last post by:
Hello! I have a problem. I have to change the size of a control added to a Form when the user resizes the Form. I use the Resize event and change the size of the control in the method which is called with the Resize event. So I implemented the docking behaving of the control because it is a part of a third-party library and it doesn't have the...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.