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

Tab Control - Referring to a page

doma23
107 100+
Hi,
The problem is next: I have a tab control with 5 pages.
On each tab page I have group of controls for 5 different periods. I tagged groups as "Period1", "Period2", "Period3" and so on.
On the bottom, after each Period, I have a delete button.
When that button is clicked I want to clear all controls for that specific period, and only on that specific page of tab control.

I have the following code for the OnClick event of delete button:
Expand|Select|Wrap|Line Numbers
  1. For Each ctl In Form_frmMain.Controls
  2.     If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
  3.         If ctl.Tag = "Period1" And Form_frmMain.TabCtl189.Value="1" Then
  4.         ctl.Value = Null
  5.         End If
  6.     End If
  7. Next ctl
The problem is that the this clears all the data on the other tab pages as well (where the control tag is "Period1"). How can I make it to clear only the controls wher TabCtl189.Value=1 (the second page).

Tnx!
Sep 13 '10 #1
4 1733
doma23
107 100+
I've been trying to do this for the last one hour, and just when I've posted the question, I've found the solution:
This is the correct code:
Expand|Select|Wrap|Line Numbers
  1. For Each ctl In Form_frmMain.Pagina91.controls
  2.     If ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Then
  3.         If ctl.Tag = "Period1" Then
  4.         ctl.Value = Null
  5.         End If
  6.     End If
  7. Next ctl
Funny...
Sep 13 '10 #2
NeoPa
32,556 Expert Mod 16PB
So, Pagina91 is the name of one of the pages on the Tab control TabCtl189?

Essentially, Pages on Tab controls have a collection of Controls just as Forms do (with some overlap of course). Another identifier is that all such controls have the page as their .Parent property.
Sep 13 '10 #3
doma23
107 100+
Yeah, Pagina91 is one of the pages on tab control TabCtl189.
I didn't know about .Parent property. Nice, it's good to know.
Basically, I coul've done it also by using this:
Expand|Select|Wrap|Line Numbers
  1. If ctl.Tag = "Period1" and ctl.Parent = "Pagina91" Then
?
Sep 13 '10 #4
NeoPa
32,556 Expert Mod 16PB
Almost :)

Either :
Expand|Select|Wrap|Line Numbers
  1. If ctl.Tag = "Period1" and ctl.Parent.Name = "Pagina91" Then
or :
Expand|Select|Wrap|Line Numbers
  1. If ctl.Tag = "Period1" and ctl.Parent Is Me.Pagina91 Then
Comparing objects is done with the keyword Is.
Sep 13 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Steve Macleod | last post by:
Hi, I am using the following code to initialise a session, depending on whether-or-not the users' log in attempt has been successful. if ($session_ok == "TRUE") { //open the session...
2
by: Mike Brearley | last post by:
I was wondering if there was an easy way to have a form set up so that when the submit button is pressed, it goes to a confirmation page that contains a back button that goes back to the page that...
2
by: buran | last post by:
Dear ASP.NET Programmers, I want to store the referring page of an .aspx page so that I can redirect the user back to the referring page if needed. I am using the following code snippet but...
3
by: Dan Sikorsky | last post by:
How can I get the Querystring passed to the Referring Page from its referrer? I don't want the querystring coming to my current page. I want the querystring that came to the referring page, so...
2
by: Chris Kettenbach | last post by:
Good Morning, I have a user control I dynamically load in the page_init event into a asp:placeholder control. This page also has another placeholder I would like to dynamically load controls into...
3
by: ivanpais | last post by:
Hi, I have a Web User Control, Lets say "Foo.ascx", that contains a button "btnFoo". I have a Master Page "Bar.master", that has a label "lblBar". This label is exposed by a public property...
3
by: Griff | last post by:
I want to build a set of compiled user controls to incorporate into a web site. The majority of user controls will be placed on specific web page and these controls would share a common...
1
by: michal2 | last post by:
Is there any way to have the referring field blank when using the GetURL command?
4
by: CG | last post by:
Hi I need to implement some low level security that locks a certain page if the user does come from a particular link (which is hosted on another domain). I've considered using HTTP_REFERER...
9
by: tomrue | last post by:
I'm looking for a way to prevent access to a web page except from a particular referring page. What I am trying to do is prevent access to a download page for anyone who has not successfully...
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: 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?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.