473,385 Members | 1,347 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.

Interface / Reflection Question

I have an interface called IChannel that has a series of items including a
delcaration for a Panel. I have a class called Channel that implements
IChannel. I'm wanting to dynamically load each channel at runtime. So, i
have a CustomerChannel that inherits Channel and it is bound at runtime and
everything i want to do happen happens.

My constructor for CustomerChannel looks like this:
CustomerChannel() : base("Customer");

This works fine!! However, now i need to have each channel that is created
and loaded dynamically to "supply" a panel of controls so that it can be
"added" to the navigation bar at runtime. My question is this: How do I
"pass" or "assign" this panel so that the main application loads it.

IChannel looks like this:

string Name {get; set; }
Panel NavPanel {get; set; }

How do i get this Panel into my main application? I hope my question makes
sense.

Thanks in advance.
Doug
Dec 1 '05 #1
4 1095

Doug Handler wrote:
I have an interface called IChannel that has a series of items including a
delcaration for a Panel. I have a class called Channel that implements
IChannel. I'm wanting to dynamically load each channel at runtime. So, i
have a CustomerChannel that inherits Channel and it is bound at runtime and
everything i want to do happen happens.

My constructor for CustomerChannel looks like this:
CustomerChannel() : base("Customer");

This works fine!! However, now i need to have each channel that is created
and loaded dynamically to "supply" a panel of controls so that it can be
"added" to the navigation bar at runtime. My question is this: How do I
"pass" or "assign" this panel so that the main application loads it.

IChannel looks like this:

string Name {get; set; }
Panel NavPanel {get; set; }

How do i get this Panel into my main application? I hope my question makes
sense.


I don't think you need any reflection here (which is good, because it's
no fun). To give you an idea what to do, create a plain winforms app,
drop a Panel on the form, and look at the autogenerated code. That will
show you how to get a Panel onto your form, once you have one. And
getting a Panel from a Channel is easy:

CustomerChannel myChannel = new CustomerChannel();
Panel channelpanel = ((IChannel)myChannel).NavPanel;
// now stuff that puts channelpanel into the actual UI container

Simple as that?

--
Larry Lard
Replies to group please

Dec 1 '05 #2
Easy: just set the position and size of the panel (via its properties),
then add it to the Controls collection of your main form:

mainForm.Controls.Add(generatedPanel);

and it will appear after the method that does the Add completes.

Dec 1 '05 #3
Hi Doug,

Check out this article on Reflection, it might help you answer your
question.

Stefan
C# GURU
www.DotNETovation.com

*** Sent via Developersdex http://www.developersdex.com ***
Dec 3 '05 #4

Oops!

Forget to post the link for the article.

http://www.developersdex.com/gurus/articles/739.asp

Stefan

*** Sent via Developersdex http://www.developersdex.com ***
Dec 4 '05 #5

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

Similar topics

3
by: Jeff Molby | last post by:
Ok, I've googled long and hard, but I can't find anything relevant on this one. I am now at the mercy of your good nature. <g> I have 3 projects in my solution: One app and 2 libraries. I am...
9
by: Anon Email | last post by:
Hi people, I'm learning about header files in C++. The following is code from Bartosz Milewski: // Code const int maxStack = 16; class IStack
6
by: Tamir Khason | last post by:
I have some classes that basicly do the same things but different way. There are no default constructors in those classes each constructor should recieve same value So Fooclass:MyBasicClass...
10
by: Chris Morse | last post by:
Hi, I'm trying to figure out how to dynamically load an assembly and get an IClientPlugin interface to a class. I can get an "Object" reference to it after doing an "Activator.CreateInstance"...
3
by: topdawg147 | last post by:
Is there any way to retrieve a list of objects that implement an interface. For example, suppose we have the following: Public Interface ISomething Function SomeFunction() As String End...
8
by: Bill Rust | last post by:
I've created an "Add Item" wizard for VB.NET 2003 that allows a user to add a specialized class that works with my application framework. In the wizard, the user can select the interfaces they...
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
8
by: rowe_newsgroups | last post by:
I know this has to be answered in the archives somewhere, but the search results are just confusing me more :-( Anyways, I authored a control library that contains an Interface definition and...
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
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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.