Click here to Skip to main content
15,902,837 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Question[Message Deleted] Pin
Kumaran21cen24-May-08 23:54
Kumaran21cen24-May-08 23:54 
AnswerRe: How to get files list from my website Pin
jzonthemtn25-May-08 14:02
jzonthemtn25-May-08 14:02 
QuestionCalender Control Pin
Sameer Khade24-May-08 20:37
Sameer Khade24-May-08 20:37 
AnswerRe: Calender Control Pin
helelark12324-May-08 21:08
helelark12324-May-08 21:08 
AnswerRe: Calender Control Pin
Piyush Vardhan Singh26-May-08 2:31
Piyush Vardhan Singh26-May-08 2:31 
QuestionConverting an inherited class into a wrapper? Pin
supercat924-May-08 8:44
supercat924-May-08 8:44 
AnswerRe: Converting an inherited class into a wrapper? Pin
Colin Angus Mackay24-May-08 9:45
Colin Angus Mackay24-May-08 9:45 
GeneralRe: Converting an inherited class into a wrapper? Pin
supercat924-May-08 13:24
supercat924-May-08 13:24 
Colin Angus Mackay wrote:
That isn't really a valid reason for inheritance.


I figured that out after I'd written a lot of the code. That's part of the reason I'd like to change the relationship to a wrapper class.

Colin Angus Mackay wrote:
I am having difficulty visualising what you mean. I suspect what you actually want is an association between the derived class and the base class rathern than inheritance, possibly with the base class and associated class sharing some common interface.


Right now what I have is a generic hierarchical collection class (hCol) which supports some features beyond the normal dictionary class, and which (more importantly, though somewhat gruesomely) I was able to implement compatibly in vb.net and vb6 (both version support serialization and deserialization, and the serialized forms are interoperable).

I also have a class which contains methods to query and set the state of external microprocessor-controlled devices using the hierarchical collection class. This class doesn't have very many fields of its own, but instead most of the information associated with the device is stored in the inherited hCol object.

Effectively, what I'd like to do is change the relationship from "A gizmo is an hCol with some other stuff" into "A gizmo is an object that contains an hCol called theHC, along with some other stuff". To do this, it would be necessary to stick "theHC." in front of all references to instances methods, properties, and fields of the underlying class, and "hCol." in front of all the shared methods, properties, and fields.

I was wondering if there's any way that VB could assist with that, since it provides so many other nice features. If VB could stick "mybase." in front of all non-overridden inherited references, that would leave the code functionally identical to what it would be without mybase, but it would then be possible to find/replace "mybase" with "theHC" and have the class behave as a wrapper.

Much of the code that uses the class would be broken by the change, but that could be fixed by adding to the "gizmo" class wrapper methods for the properties that get used most often (most notably the default subscripting property), and adding properties to access the underlying hCol object when trickier operations are required.

If the only practical way to do the conversion is to remove the "Inherits" statement and then patch all of the blue-underlined code, I could do that, but if there's a more convenient method it would be good to know it.

Colin Angus Mackay wrote:
Perhaps if you described your actual problem instead of attempting to hide what you are trying to do then we can help.


Sorry to be mysterious. As a contract engineer, I'm not always certain what information clients would consider 'sensitive', so I try to be discrete. Further, when asking questions, I try to focus on the essence of the question rather than posting oodles of information about exactly what I'm doing, much of which wouldn't really be relevant to the issue at hand.

I hope the above description of what I'm doing is helpful.

As for level of understanding, I've been writing code for embedded systems for over 15 years. I've been maintaining for about five years a mess of VB6 code someone else wrote, and started about six months ago working with Visual Studio.net, mostly working in vb.net but also integrating unmanaged C code. I've also become a lot more intricately familiar with vb6 over the last six months, and increasingly amazed at how broken its object handling is (the existing mess of vb6 code didn't define any new classes until about six months ago).

At this point, I know a way to do most of the things I need to do with vb.net, but recognize that I still have a lot to learn. Knowing how to turn a "foo" into a "glorp", a "glorp" into a "boz", and a "boz" into a "bar" means that I know a way to turn a "foo" into a "bar", but that doesn't mean I know how it should be done. I'd like to avoid getting into too many bad habits, so advice in the right direction would be helpful. Thanks for any assistance you may provide.
GeneralRe: Converting an inherited class into a wrapper? Pin
theitmueller25-May-08 2:02
theitmueller25-May-08 2:02 
GeneralRe: Converting an inherited class into a wrapper? Pin
supercat925-May-08 12:04
supercat925-May-08 12:04 
AnswerRe: Converting an inherited class into a wrapper? Pin
Scott Dorman25-May-08 1:57
professionalScott Dorman25-May-08 1:57 
QuestionVB with crystal report problem Pin
monika_vasvani24-May-08 7:43
monika_vasvani24-May-08 7:43 
AnswerRe: VB with crystal report problem Pin
Mohammad Al Hoss25-May-08 23:45
Mohammad Al Hoss25-May-08 23:45 
GeneralRe: VB with crystal report problem Pin
monika_vasvani2-Jun-08 22:13
monika_vasvani2-Jun-08 22:13 
GeneralRe: VB with crystal report problem Pin
Mohammad Al Hoss3-Jun-08 2:40
Mohammad Al Hoss3-Jun-08 2:40 
QuestionAdd custom task pane in outlook 2003 using vb.net 2005 Pin
~Khatri Mitesh~24-May-08 4:47
~Khatri Mitesh~24-May-08 4:47 
QuestionRegex required Pin
d_smit24-May-08 4:23
d_smit24-May-08 4:23 
QuestionLogin Restriction Pin
Sritanu _ Ghosh24-May-08 3:54
Sritanu _ Ghosh24-May-08 3:54 
AnswerRe: Login Restriction Pin
jzonthemtn24-May-08 5:10
jzonthemtn24-May-08 5:10 
GeneralRe: Login Restriction Pin
Sritanu _ Ghosh26-May-08 3:58
Sritanu _ Ghosh26-May-08 3:58 
GeneralRe: Login Restriction Pin
jzonthemtn26-May-08 7:30
jzonthemtn26-May-08 7:30 
QuestionConverting MFC apps to .net Pin
Fu Manchu24-May-08 1:17
Fu Manchu24-May-08 1:17 
AnswerRe: Converting MFC apps to .net Pin
Garth J Lancaster24-May-08 2:32
professionalGarth J Lancaster24-May-08 2:32 
GeneralRe: Converting MFC apps to .net Pin
Fu Manchu24-May-08 2:51
Fu Manchu24-May-08 2:51 
GeneralRe: Converting MFC apps to .net Pin
Garth J Lancaster24-May-08 2:56
professionalGarth J Lancaster24-May-08 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.