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

vb6/vb.net puzzle

I've found a puzzle with my legacy app and my new .Net dll.

I have defined an abstract base class

Public MustInherit Class AbstractFoos
Inherits CollectionBase

Public MustOverride Sub Append(ByRef poField As ACIndex)
Public MustOverride Sub Delete(ByRef psName As String)

' other defs
End Class

I've defined a concrete class

Public Class ConcreteFoos
Inherits AbstractFoo

Public Overrides Sub Append(ByRef poField As ACIndex)
... stuff ...
End Sub
Public Overrides Sub Delete(ByRef psName As String)
... stuff ...
End Sub

End Class

Public Class Bar
dim moFoos as ConcreteFoos

public readonly property get Foos as ConcreteFoos
Get
return moFoos
End Get
End Property
End Class

So ConcreteFoos provides the implementations necessary, plus has all of
the nifty CollectionBase stuff, such as Count. Bar is the ultimate
provider of ConcreteFoos via the Foos property. So far, so good.

In my vb6 app, I create a Bar and try to access the Count property of
the Foos property - should work just fine.

dim myBar as new Bar
... add some Foos ...
debug.print "Count is " & myBar.Foos.Count

This ALWAYS returns 0, regardless of the number of ConcreteFoos actually
exist. However, if I do this

dim myBar as new Bar
... add some Foos ...

dim myFoos as ConcreteFoos
set myFoos = myBar.Foos
debug.print "Count is " & myFoos.Count

I get the correct number of ConcreteFoos.

I've rewritten the test code in .Net and it works correctly there.

Am I missing something obvious? Does this make sense?

As an aside, this is the app I was asking about earlier this morning vis
a vis debugging between VB6 and .Net IDEs. The simple test program as
well as my main legacy app both crash the IDEs when I try to step across
the IDE boundary, and also when I try to step into the .Net dll from the
the compiled executable.

I'm really puzzled. I wanna believe that this is problem with my code -
I can fix it if it is, but the fact that the code fails one way but
works the other makes me think there's something funny about the COM
Interop layer.

Thanks for any insights!
Sean

Nov 21 '05 #1
1 1516
Hi Sean,

From your description, it seems that the member moFoos in not initialized
when declaration, so when did it initialized(i.e. Created)
Public Class Bar
dim moFoos as ConcreteFoos
public readonly property get Foos as ConcreteFoos
Get
return moFoos
End Get
End Property
End Class

I think maybe the different creating procedure cause the different
behavior. Because VB.NET and VB is totally a different programming language
except they have the similar syntax, in nature, VB.NET is kind of .NET
language which have the similar syntax with VB6. So call it from unmanaged
code /managed code may differ.

So far I think you may try to add Trace code in every necessary method call
which will be called when you trying to call .Count property.
e.g. Write to a file as a log.

If you still have any concern, can you help to build a simple reproduce
sample for us to reproduce/troubleshooting the problem.
Thanks for your efforts!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2

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

Similar topics

1
by: Developwebsites | last post by:
Hi all, I've made a sliding puzzle game in shockwave which works just fine, except I dont know how to have it solve itself. the URL is: http://members.aol.com/rglukov/games/selfsolve.htm ...
42
by: Frank Buss | last post by:
I've setup a challenge, mainly for C++, Java and Lisp, but every other language is welcome: http://www.frank-buss.de/challenge/index.html There is nothing to win, but I hope there will be some...
1
by: xavier vazquez | last post by:
I have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of...
0
by: xavier vazquez | last post by:
have a problem with a program that does not working properly...when the program run is suppose to generate a cross word puzzle , when the outcome show the letter of the words overlap one intop of the...
5
by: ashish0799 | last post by:
HI I M ASHISH I WANT ALGORYTHMUS OF THIS PROBLEM Jigsaw puzzles. You would have solved many in your childhood and many people still like it in their old ages also. Now what you have got to do...
3
by: oncue01 | last post by:
Word Puzzle Task You are going to search M words in an N × N puzzle. The words may have been placed in one of the four directions as from (i) left to right (E), (ii) right to left (W), (iii) up...
6
by: Phoe6 | last post by:
Hi All, I would like to request a code and design review of one of my program. n-puzzle.py http://sarovar.org/snippet/detail.php?type=snippet&id=83 Its a N-puzzle problem solver ( Wikipedia page...
2
by: Gio | last post by:
I'm getting K&R (it's on the way), should I also get the Answer Book? And while I'm there, should I get the Puzzle Book? Or should I save the Puzzle Book for when I'm more advanced? - Gio ...
4
by: honey777 | last post by:
Problem: 15 Puzzle This is a common puzzle with a 4x4 playing space with 15 tiles, numbered 1 through 15. One "spot" is always left blank. Here is an example of the puzzle: The goal is to...
5
by: dmf1207 | last post by:
Hi All! I'm new to javascript and need a little help with a simple puzzle im trying to design. I have a 600x100 pixel picture that I have sliced into 6 100x100 rectangles making a table of of 6...
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: 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...
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...

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.