Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 17th, 2003, 01:55 PM
Registered User
 
Join Date: Oct 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can you solve the simple problem ?

Hi,

I have the following Syntax :

Panel1.Contros.Add(Button1);

I want to make it as generic, not specific to Panel1 (It may be Panel1, Panel2...etc...).During runtime i can pass either "Panel1" or "Panel2" or etc... Is there any way to do that ?

Here are the ways I think so

1. Pointer Technique
2. Object reference
3. Handle

Can you give me sample example on each of them how to use them ?

Advance ThanX for your time & patience.

Cheers,
Kishore

 
Old October 24th, 2003, 10:22 PM
Authorized User
 
Join Date: Jun 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to HuhOiC
Default


How about this:

public void AddtoPanel(Panel pan)
{
    pan.Controls.add(Button1);

 ......
}

or this is not what you exactly wanted.

the same idea goes for pointer to a panel except it's already pointing to a hopefully some non-null number that specifies the panel and you can just do pan->Controls.add(Button1); if your doing it in VC++, and object reference unbox it as a Panel type you can check if it is a Panel type with the "is" reserved word.

RAyRAy



RAyRAy
Huh O i C

Program or Be Programmed!!!
 
Old November 3rd, 2003, 09:16 PM
Registered User
 
Join Date: Nov 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to uponline_aom
Default

thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
simple code, solve many problems KeviJay Visual Basic 2005 Basics 2 September 8th, 2008 06:17 AM
Need help to solve problem PankajMishra XSLT 7 April 19th, 2007 08:27 AM
Will you please help me to solve this problem....? vis_kapadia Excel VBA 2 November 22nd, 2006 04:57 AM
HELP! Can anyone solve this problem? JoeR VB How-To 3 September 5th, 2006 09:56 AM
could you solve my problem? Robin1 Javascript 0 September 13th, 2004 10:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.