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

Tab Controls - How do I know which tab I am going to while still on the current tab?

I have a windows form with three tabs. In the instance where a
specific one is selected, I need to do some validation to determine if
the user may navigate to one of the other two, but not when navigating
to the other of the two.

Here's the scenario:
I have tabs A, B and C. When the user is on tab B and wish to go to
tab C, I need to run some validation to determine if I can allow them
to do that. However, they may navigate to tab A at anytime. So, I am
intersted in knowing how to identify, while tab B is still 'selected',
during the validating event of tab B, to which tab I will then be
navigating. Is there an attribute on the tab control that will tel me
this, or something to that effect? Any help would be appreciated.
Nov 20 '05 #1
2 1132
Hi Brian,

I don't know about you, but any time a program lets me do something and
then tells me off when I dare to do it, I send a curse through the ether to
the programmer. If there are a lot of things like that in a program then it
finds itself teetering on the edge of the Recycle Bin - like Homer and the
Black Hole - what an episode!! ;-))

Prevention beats a curse - if Tab C is off-limits when on Tab B, disable
it.

If this is a dynamic property, dependant on what the User is doing while
on Tab B, enable and disable Tab C as required. If nothing else this will
teach the User the effect of their actions.

Unfortunately, that doesn't stop the User from clicking on the TabPage,
it disables the Controls on it. So to give some indication that this is the
case, you could enclose the TabPage caption in brackets, or set it to lower
cse or something.

The code below shows you two ways to do this. The first removes and adds
brackets as required. The second saves the existing caption in the TabPage's
Tag property.

Regards,
Fergus

<code>
'Encloses the TabPage's caption in brackets when disabled.
Public Sub SetTabPageEnable (PageIndex As Integer, IsEnabled As Boolean)
With TabControl1.TabPages (PageIndex)
.Tag = .Text
Dim sCaption As String = .Text
If sCaption.Substring (0, 1) = "(" Then
sCaption = Mid (sCaption, 2, Len (sCaption) - 2)
'or
sCaption = sCaption.Substring (1, sCaption.Length - 2)
End If
If IsEnabled = False Then
sCaption = "(" & sCaption & ")"
End If

.Enabled = IsEnabled
.Text = sCaption
End With
End Sub

'This assumes that the TabPage will be disabled before it is
're-enabled. so the Tag property will be valid.
'Encloses the TabPage's caption in brackets when disabled.
Public Sub SetTabPageEnable (PageIndex As Integer, IsEnabled As Boolean)
With TabControl1.TabPages (PageIndex)
.Enabled = IsEnabled
If IsEnabled Then
.Text= .Tag
Else
.Tag = .Text
.Text = "(" & .Text & ")"
End If
End With
End Sub
</code>
Nov 20 '05 #2
* bs**********@aol.com (Brian Schmidt) scripsit:
I have a windows form with three tabs. In the instance where a
specific one is selected, I need to do some validation to determine if
the user may navigate to one of the other two, but not when navigating
to the other of the two.

Here's the scenario:
I have tabs A, B and C. When the user is on tab B and wish to go to
tab C, I need to run some validation to determine if I can allow them
to do that. However, they may navigate to tab A at anytime. So, I am
intersted in knowing how to identify, while tab B is still 'selected',
during the validating event of tab B, to which tab I will then be
navigating. Is there an attribute on the tab control that will tel me
this, or something to that effect? Any help would be appreciated.


See:

<http://groups.google.com/groups?selm=hxAg9.261485%24kp.887854%40rwcrnsc52.o ps.asp.att.net>

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

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

Similar topics

3
by: DBQueen | last post by:
I have a form with lines of controls. On some of the lines there are 3 controls (call them A,B,C); other lines have only control A. The controls have been numbered sequentially (Q20, Q21....Q76)...
3
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event...
4
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event....
5
by: Amelyan | last post by:
How can I get state of dynamically created controls (RadioButton, CheckBox, TextBox.Text) on post back when I click submit button? The only way I know is by traversing Response.Form enumberator;...
8
by: | last post by:
I'm looking for some design guidance on a collection of projects I'm working on. The project involves a bunch of websites constructed out of a collection of user controls. Different user...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
JimWu
by: JimWu | last post by:
I have some problems in my code. The stutiation illustrate as the followsing statement. I use two pages, one, named "upload.aspx", is including several general html input tag, whose type are...
0
by: Syoam4ka | last post by:
My project is about jewellery. I have devided my jewelery into main types, which each one of them has sub types, and each one those sub types has the jewellery. I have a tabcontainer. It includes...
3
by: =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post by:
Hi all It is maybe a stupid question, but I have some trouble with Inheritance. For example: I create a new class with one form. On this form I place on the bottom a Panel and on this Panel...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.