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

Passing a TabPage as a parameter

Dom
I have 5 TabPages, and I pass one of them to a procedure. How do I
know which page I have?

All I can think of is using the Name property of the TabPage.

void SetPage (TabPage t)
{
if (t.Name = "tabFirst") {...}
else if (t.Name = "tabSecond") {...}
}

May 7 '07 #1
4 1484
Dom,

You already are passing a TabPage to the procedure. It appears though
that you want to have separate logic depending on a property of the page (in
this case, the Name property). In situations like these, you have to have
conditional statements (like you have now) or have separate methods which
you call for different values on the property you are switching on.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dom" <do********@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
>I have 5 TabPages, and I pass one of them to a procedure. How do I
know which page I have?

All I can think of is using the Name property of the TabPage.

void SetPage (TabPage t)
{
if (t.Name = "tabFirst") {...}
else if (t.Name = "tabSecond") {...}
}

May 7 '07 #2
Dom
Maybe I didn't explain myself well. I am passing one of the TabPages
to a procedure. How do I know, *within the procedure*, which TabPage
has been sent. Should I branch on the Name property, or on the Text
Property, or set the Tag property and branch on that, etc? Is there a
best practive here?

On May 7, 10:21 am, Dom <dolivas...@gmail.comwrote:
I have 5 TabPages, and I pass one of them to a procedure. How do I
know which page I have?

All I can think of is using the Name property of the TabPage.

void SetPage (TabPage t)
{
if (t.Name = "tabFirst") {...}
else if (t.Name = "tabSecond") {...}

}

May 7 '07 #3
Dom,

That's completely up to you and what you are doing with the TabPage.
There can't be a best practice because the domain is so unique. It all
depends on what the rules are. For example, if know know that the Name
property is going to be unique and keyed to a certain tab page, then use
that. Or the Text property, or the Tag property. It's completely up to
you.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dom" <do********@gmail.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
Maybe I didn't explain myself well. I am passing one of the TabPages
to a procedure. How do I know, *within the procedure*, which TabPage
has been sent. Should I branch on the Name property, or on the Text
Property, or set the Tag property and branch on that, etc? Is there a
best practive here?

On May 7, 10:21 am, Dom <dolivas...@gmail.comwrote:
>I have 5 TabPages, and I pass one of them to a procedure. How do I
know which page I have?

All I can think of is using the Name property of the TabPage.

void SetPage (TabPage t)
{
if (t.Name = "tabFirst") {...}
else if (t.Name = "tabSecond") {...}

}


May 7 '07 #4
Hi,

"Dom" <do********@gmail.comwrote in message
news:11**********************@n59g2000hsh.googlegr oups.com...
Maybe I didn't explain myself well. I am passing one of the TabPages
to a procedure. How do I know, *within the procedure*, which TabPage
has been sent. Should I branch on the Name property, or on the Text
Property, or set the Tag property and branch on that, etc? Is there a
best practive here?
Why is important for you to know that?

In any case, you could pass another parameter that indicate which tab you
are dealing with, it could be either the index or a descriptive name, or
even an enum.
May 7 '07 #5

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

Similar topics

2
by: Thomas Philips | last post by:
To experiment with filtering, I define a function f(x,k) as follows >>> def f(x,k=2): return x%k==0 I can check that it works by typing >>> f(10,3) False Now, I try to filter a range using...
2
by: muser | last post by:
How can I pass the parameter " long part_num, into a case statement. Case statement follows the function CheckDigit. i.e. CheckDigit( something, temp1 ); Thank you for your help in advance. ...
2
by: Nautilus | last post by:
Taken from a couple very similar samples on the net, I'm having trouble passing a parameter to a PHP file. Here's all the JS code ... it creates an image object and modifies it's src to make a...
10
by: Tracy | last post by:
Dear all, I have encountered a problem in passing a VARCHAR parameter (which is a list of accepted values) to the IN predicate of a DB2 user-defined function. For example, I have a table...
0
by: dawg1998 | last post by:
I am able to populate a DropDownList control within multiple rows of a GridView with the following code: `````````````````````````````````````````````````````` <asp:GridView id="gvGridView"...
5
by: Chris Ashley | last post by:
I'm getting a little confused at the behaviour of C# with one of my class constructors. A code example will probably help: public class RawBitmap { internal BITMAPFILEHEADER fileHdr; internal...
2
by: JackC | last post by:
Hi, I create my threads like this: for(int j = 0; j < 5; j++) { boost::thread *thr = new boost::thread(worker_func); threads.add_thread(thr); }
3
by: fxeko | last post by:
Hi all... I have got a problem about passing data parameter in data report VB6 my problem: x= "admin" how to send value of x variabel to data report Thanks for your advabced
13
by: masso600 | last post by:
char word; in = fopen("test.txt", "r"); while(fscanf(in,"%s",&word)!=EOF) { /* Print all words */ /* printf("%s\n",&word); */
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...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

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.