BobRodes's Profile User Rating: *****

Reputation: 592 Enlightened
Active Posts:
3,060 (1.31 per day)
19-May 09
Profile Views:
Last Active:
User is offline Sep 11 2015 11:42 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Who Cares
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Expert In:

Latest Visitors

Icon   BobRodes is a paragon of ignorance.

Posts I've Made

  1. In Topic: VB6 vrs Visual Basic or Pascal and help.

    Posted 11 Sep 2015


    In VB6 I have to learn how to assign a variable I can pass to source.

    Not quite sure what you are looking for yet. I looked up "real" in Pascal and found single-precision floating-point value. VB6 has a "Single" variable type that is the same. Perhaps you can use that? An alternative is to use the Variant type, which will implicitly convert to any type.
  2. In Topic: Abstract class constructor question.

    Posted 11 Sep 2015

    Although it's not entirely clear to me, it looks like you have a sort of third-generation implementation of the singleton pattern. The point of a singleton pattern is to have one and only one instance of your object servicing all requests to that object. The implementation logic is to check for an existing instance of the object, and if there isn't one, to create it. I think that's about what you're trying to do, so I'll share some details. It's certainly some of "this kind of weird stuff," so perhaps you'll find it useful.

    Typical implementation is to override the constructor to make it private, and then expose a method that implements the singleton logic. One of the problems with this is that you can run into thread conflicts between different requests to the object. So, you have to lock the code to make sure that the check for the existing instance and the instance creation execute atomically. Here's an old bit of sample code I wrote some time ago, that implements this:

         public class DataExporter : iDataExporter
            private DataExporter instance = null;  //Holds a private reference to the singleton instance.
            private object locker = new object();  //Used to lock a block of code.
            /// <summary>
            /// overriding the default constructor to make it private.  Doing this has the effect of requiring 
            /// instantiation via a method or property (as opposed to using the new keyword), in this case 
            /// the Instance property. 
            /// </summary>
            private DataExporter() { }
            /// <summary>
            /// The reason that we are using the instance property is because there is no way within the context of 
            /// the constructor to place conditions on how an instance of the class is returned.  A construct such 
            /// as "public DataExporter DataExporter() {return new DataExporter;}" fails to compile.
            /// </summary>        
            public DataExporter Instance
                    lock (locker) //locking makes the code in the brackets execute atomically.  This code is the basic
                    //singleton pattern: check for an existing instance, if not found create it, return result.
                        if (null == instance)
                            instance = new DataExporter(); //self-reference
                        return instance;

    You would call this in this manner: DataExporter de = DataExporter.Instance;

    Now, setting it up the Instance property as static has the same effect. The accompanying notes to this code snippet explain why:

        public sealed class DataExporter : iDataExporter
            private static readonly DataExporter instance = new DataExporter();  //Holds a private reference to the singleton instance.
            /// <summary>
            /// Overriding the default constructor to make it private.  Doing this has the effect of requiring instantiation via a
            /// method (as opposed to using the new keyword), in this case the Instance property accessor method.
            /// </summary>
            private DataExporter() { }
            /// <summary>
            /// Making the Instance property static has the de facto effect of implementing the singleton pattern, since there is only one 
            /// instance of the object.  Thread safety is guaranteed by the CLR.  This is simpler than the more specific "roll your own" 
            /// version of singleton pattern implementation, which requires locks to be thread safe.
            /// </summary>        
            public static DataExporter Instance
                get { return instance; }

    As you can see, leveraging the fact that the CLR enforces thread safety makes for a lot less drama.
  3. In Topic: Object Library Not registered

    Posted 11 Sep 2015

    Andrew, you know VBA better than I do, but in VB6 missing reference happens when you set a reference to a class and then unregister the class. It happens most often when you are building classes of your own, since by default every time you recompile you assign a new GUID to your class. The MaskedEdit control is under Tools/Components. While you can find missing references there, too, you would have to set a reference and then specifically unregister the ocx.

    Zainal, if you haven't done that, then perhaps you don't have

    The masked edit control is under components rather than references. So, double check to be sure that you have the component selected. If you do not, then select it. If you can't find it, look to see if msmask32.ocx is registered. If you don't know how to do that, post back.
  4. In Topic: VB6 vrs Visual Basic or Pascal and help.

    Posted 11 Sep 2015

    Larry, it sounds like whoever wrote the GUI didn't understand your requirements very well. It might be worthwhile to consider modifying the code to create a GUI that meets them better. If you can already use Basic, it shouldn't be that hard to pick up.
  5. In Topic: VB6 and Zabo Business Objects

    Posted 11 Sep 2015

    View Postmaj3091, on 16 August 2015 - 11:43 PM, said:

    Got out of the wrong side of the bed this morning Bob? :)/>

    It's just that seemed so inadequate to the situation at hand... :sad2:

My Information

Member Title:
Lovable Curmudgeon
59 years old
September 15, 1956
Manchester, Tennessee
IT, Music.
Forum Leader:
Full Name:
Bob Rodes
Years Programming:
Programming Languages:
BASIC, VB6, VB.Net, C#, Java, Javascript, CSS, also UML

Contact Information

Click here to e-mail me


Page 1 of 1
  1. Photo

    lucky3 Icon

    31 Dec 2012 - 02:30
    Congratulations for the "Expert of the Year" 1st place award!
  2. Photo

    Elda Icon

    23 Jul 2012 - 19:09
    Congratulations. You're an expert. you deserved it. :)
  3. Photo

    trevster344 Icon

    15 Jun 2012 - 17:53
    I found your post in the thread, that is now locked in the .net forum, to be quite humorous. Just wanted to say I appreciate your work and effort helping people out, because sometimes I don't have the patience myself to sit there spoon feeding people information. Thanks :)
  4. Photo

    15Dhan Icon

    01 May 2012 - 18:15
    Congrats .. IDOL :)
  5. Photo

    haidar976 Icon

    18 Aug 2011 - 23:55
    How can you manage all these languages without be confusing between them? I tried to learn C++ then after few months changed to VB6 I completely forgot every thing about C++, I cant work with two language in the same time
    You are expert man
  6. Photo

    BobRodes Icon

    15 Feb 2011 - 15:02
    Thanks for the recognition. I'm honored.
  7. Photo

    Dogstopper Icon

    14 Feb 2011 - 19:35
    Congratulations on Expert!
Page 1 of 1