473,503 Members | 3,497 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very vague question on object-oriented design and VB.Net

(I'm not too comfortable with inheritance in VB and I don't think I've ever
read about a situation like this.)

Let's assume Dot Net 1.1 and VB.Net.

Let's assume a main Winforms program and a separate assembly that has an
abstract base class and an uncertain number of child classes (which in turn
may have children of their own.)

Now lets assume that the Winforms program instantiates these. Let's assume
the main program doesn't have much to do as far as instantiation is concerned
and I don't want to have to modify it every time I add a new child class to
the assembly.

What I would like to do is read off the list of available classes in the
assembly and possibly let the user select them from a popup list.

How might I go about doing this? Are there any good examples out there that
do this? (Is this even possible?)
Nov 21 '05 #1
6 1108
B.

You are not the first who ask this question. What is the difference between
your solution from the view of the user than that he select them from a menu
and you instance them in your program in the normal ways.

When you want to overcome deployment, make than your menu class dynamicly
depending on a kind of config file.

For me this sounds as a question, "how can I drink from an open glas when I
have it upside down? It is not impossible however a lot of extras to do.

Just my thought,

Cor
Nov 21 '05 #2
Ctrl Alt J will open up the object browser, and you can find all the classes
in your assembly
--
OHM ( Terry Burns )

http://TrainingOn.net


"B. Chernick" <BC*******@discussions.microsoft.com> wrote in message
news:F3**********************************@microsof t.com...
(I'm not too comfortable with inheritance in VB and I don't think I've
ever
read about a situation like this.)

Let's assume Dot Net 1.1 and VB.Net.

Let's assume a main Winforms program and a separate assembly that has an
abstract base class and an uncertain number of child classes (which in
turn
may have children of their own.)

Now lets assume that the Winforms program instantiates these. Let's
assume
the main program doesn't have much to do as far as instantiation is
concerned
and I don't want to have to modify it every time I add a new child class
to
the assembly.

What I would like to do is read off the list of available classes in the
assembly and possibly let the user select them from a popup list.

How might I go about doing this? Are there any good examples out there
that
do this? (Is this even possible?)

Nov 21 '05 #3
From what I understand, you are asking if you can get a list of avaliable
classes from an other assembly inside your windows app and then create an
instance of that class. Try using reflection by importing the
System.Reflection namespace. Take a look at the [Assembly].LoadFrom() method.

http://msdn.microsoft.com/library/de...dfromtopic.asp

"B. Chernick" wrote:
(I'm not too comfortable with inheritance in VB and I don't think I've ever
read about a situation like this.)

Let's assume Dot Net 1.1 and VB.Net.

Let's assume a main Winforms program and a separate assembly that has an
abstract base class and an uncertain number of child classes (which in turn
may have children of their own.)

Now lets assume that the Winforms program instantiates these. Let's assume
the main program doesn't have much to do as far as instantiation is concerned
and I don't want to have to modify it every time I add a new child class to
the assembly.

What I would like to do is read off the list of available classes in the
assembly and possibly let the user select them from a popup list.

How might I go about doing this? Are there any good examples out there that
do this? (Is this even possible?)

Nov 21 '05 #4
Thanks to all who have replied.

Yes, I have wondered if Reflection might be of use and I will probably study
it some more. But I think my primary frustration is that there is no way to
declare a class without a literal.

To put it more clearly, what I would like to do is this:
dim x as New <variable containing a type selected by choice list>

....and so far as I know, that is impossible in VB.Net. Back to the drawing
board.

(Or am I forgetting something?)

"rmacias" wrote:
From what I understand, you are asking if you can get a list of avaliable
classes from an other assembly inside your windows app and then create an
instance of that class. Try using reflection by importing the
System.Reflection namespace. Take a look at the [Assembly].LoadFrom() method.

http://msdn.microsoft.com/library/de...dfromtopic.asp

"B. Chernick" wrote:
(I'm not too comfortable with inheritance in VB and I don't think I've ever
read about a situation like this.)

Let's assume Dot Net 1.1 and VB.Net.

Let's assume a main Winforms program and a separate assembly that has an
abstract base class and an uncertain number of child classes (which in turn
may have children of their own.)

Now lets assume that the Winforms program instantiates these. Let's assume
the main program doesn't have much to do as far as instantiation is concerned
and I don't want to have to modify it every time I add a new child class to
the assembly.

What I would like to do is read off the list of available classes in the
assembly and possibly let the user select them from a popup list.

How might I go about doing this? Are there any good examples out there that
do this? (Is this even possible?)

Nov 21 '05 #5
I'm afraid that reflection may be the only alternative. The following link
shows an example on how to dynamically create your type and then invoke it's
members. It takes a little work but it accomplishes what you want to do:

http://msdn.microsoft.com/library/de...embertopic.asp

"B. Chernick" wrote:
Thanks to all who have replied.

Yes, I have wondered if Reflection might be of use and I will probably study
it some more. But I think my primary frustration is that there is no way to
declare a class without a literal.

To put it more clearly, what I would like to do is this:
dim x as New <variable containing a type selected by choice list>

...and so far as I know, that is impossible in VB.Net. Back to the drawing
board.

(Or am I forgetting something?)

"rmacias" wrote:
From what I understand, you are asking if you can get a list of avaliable
classes from an other assembly inside your windows app and then create an
instance of that class. Try using reflection by importing the
System.Reflection namespace. Take a look at the [Assembly].LoadFrom() method.

http://msdn.microsoft.com/library/de...dfromtopic.asp

"B. Chernick" wrote:
(I'm not too comfortable with inheritance in VB and I don't think I've ever
read about a situation like this.)

Let's assume Dot Net 1.1 and VB.Net.

Let's assume a main Winforms program and a separate assembly that has an
abstract base class and an uncertain number of child classes (which in turn
may have children of their own.)

Now lets assume that the Winforms program instantiates these. Let's assume
the main program doesn't have much to do as far as instantiation is concerned
and I don't want to have to modify it every time I add a new child class to
the assembly.

What I would like to do is read off the list of available classes in the
assembly and possibly let the user select them from a popup list.

How might I go about doing this? Are there any good examples out there that
do this? (Is this even possible?)

Nov 21 '05 #6
Thanks!

"rmacias" wrote:
I'm afraid that reflection may be the only alternative. The following link
shows an example on how to dynamically create your type and then invoke it's
members. It takes a little work but it accomplishes what you want to do:

http://msdn.microsoft.com/library/de...embertopic.asp

"B. Chernick" wrote:
Thanks to all who have replied.

Yes, I have wondered if Reflection might be of use and I will probably study
it some more. But I think my primary frustration is that there is no way to
declare a class without a literal.

To put it more clearly, what I would like to do is this:
dim x as New <variable containing a type selected by choice list>

...and so far as I know, that is impossible in VB.Net. Back to the drawing
board.

(Or am I forgetting something?)

"rmacias" wrote:
From what I understand, you are asking if you can get a list of avaliable
classes from an other assembly inside your windows app and then create an
instance of that class. Try using reflection by importing the
System.Reflection namespace. Take a look at the [Assembly].LoadFrom() method.

http://msdn.microsoft.com/library/de...dfromtopic.asp

"B. Chernick" wrote:

> (I'm not too comfortable with inheritance in VB and I don't think I've ever
> read about a situation like this.)
>
> Let's assume Dot Net 1.1 and VB.Net.
>
> Let's assume a main Winforms program and a separate assembly that has an
> abstract base class and an uncertain number of child classes (which in turn
> may have children of their own.)
>
> Now lets assume that the Winforms program instantiates these. Let's assume
> the main program doesn't have much to do as far as instantiation is concerned
> and I don't want to have to modify it every time I add a new child class to
> the assembly.
>
> What I would like to do is read off the list of available classes in the
> assembly and possibly let the user select them from a popup list.
>
> How might I go about doing this? Are there any good examples out there that
> do this? (Is this even possible?)

Nov 21 '05 #7

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

Similar topics

1
1506
by: Don Bruder | last post by:
Greetings, oh scaly ones... :) I'm a Mac user with a fairly high level of computer literacy, including reasonable programming skills in BASIC, C, Pascal, and several flavors of ML, just trying...
9
2524
by: Robert Misiorowski | last post by:
Hello, I have a very perplexing (at least to me) problem that hopefully someone can help me with. I'm making a site with a 3 column layout. In the middle column (my fluid column) I am trying to...
50
5651
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
13
1889
by: groupy | last post by:
input: 1.5 million records table consisting users with 4 nvchar fields:A,B,C,D the problem: there are many records with dublicates A's or duplicates B's or duplicates A+B's or duplicates B+C+D's &...
3
2782
by: Dibur | last post by:
Hi, The way authorities are granted in DB2 are very vague.In one of our production systems the users under staff group in AIX have sysmon authorities and i have checked dbm cfg and there...
7
3369
by: akennis | last post by:
First of all, sorry for duplicating this post. I put it up in the alt.comp.lang.learn.c-c++ mistakenly. I'm investigating a problem whereby exceptions thrown from functions in a Shared Library...
0
1015
by: ajos | last post by:
hello friends, what ive done is(in short) in my servlet class---> ArrayList<String> list=new ArrayList<String>(); while(resultset.next()) { s4 =...
1
1154
by: pegasus3 | last post by:
I have a vague idea, however, this program is supposed to ask for a user number input, then another window will open with a number of squares (one inside the other) and they must have a color. ...
2
1747
by: Chad | last post by:
The following question actually stems from an old Chris Torek post. And I quote from the following old CLC url ...
0
7192
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
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
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...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.