Wrapping controls WithEvents in classes (1 Viewer)

jwcolby54

Active member
Local time
Today, 16:53
Joined
May 19, 2025
Messages
303
I've been doing this since the late nineties. I am finishing up a book on the subject which can be found on my blog about the subject.

 
Last edited:
Is that your sole reason for joining here, just to advertise?
 
LOL. I am retired. I know a lot of stuff. I am trying to get it written down and let others see it. Is that a problem? Have you ever written a book? It takes a lot of time. I don't have the time to be a question answering guru or anything like that. If folks find my stuff they can learn much of the important stuff I know and I can answer questions specific to my areas of interest.

Teach a man to fish? Except they have to find my work first right?
 
It is useful now. I have 182 pages written, and it is in a pdf format up on my blog. A link to my Blog is in my signature now.

Just know that this is a very complex subject, so the book is not "finished". But it's absolutely ready and useful in its current state. Eventually it will be in a library state, developed into a framework.

I spent probably four years developing the concepts of object wrappers, and then building out classes encapsulating whatever I thought was a good idea. It became the framework behind a call center app I was writing at the time for Disability Insurance Specialists in CT where I lived at the time. That was the early 2000s.
 
Last edited:
It is useful now. I have 182 pages written, and it is in a pdf format up on my blog. I am not allowed to post a link to my blog however. Google jwcolby and Blogspot and you get right there.

Just know that this is a very complex subject, so the book is not "finished". But it's absolutely ready and useful in its current state. Eventually it will be in a library state, developed into a framework.

I spent probably four years developing the concepts of object wrappers, and then building out classes encapsulating whatever I thought was a good idea. It became the framework behind a call center app I was writing at the time for Disability Insurance Specialists in CT where I lived at the time. That was the early 2000s.
Since @NauticalGent suggested your blog in one of my questions, I've been fascinated with your works.
I've learnt a lot from you and never had the opportunity to thank you.
I really appreciate every single thing I learnt from you.
Thank you.
 
That Google phrase, even without the and does not get to your Blogspot
It does get here though. :)

1747753386543.png
 
Ok, for those who could be interested, the link is actually https://jwcolby.blogspot.com/2025/05/the-book-event-driven-programming-in.html
This is a better link to all the sections.

Now John, I have a question. Please excuse my likely stupidness, but on Page 18 we are creating basInitClass and basInitClasses ?
It appears that I create basInitClass and the save it again as basInitClasses?, which I cannot do, unless I copy all the code to a new module.
Looking at your demo db, there is no basInitClass?

Could you elaborate on this please?
 
Last edited:
Gasman, first Kudos for actually making it through to here. Second, My bad. basInitClasses (should be plural) is a place where I will be setting up this initialization structure for various classes, one for each class that needs it. Not all will. I have corrected the book to make the original line to use the plural, InitClasses.
And finally, I need all the feedback I can get. I was involved in two Wrox books and when working with a publisher they hire folks to go line by line of the written stuff checking for errors. In this case, it is up to me and my readers to find this stuff. My thanks to you for doing so,, and good job!
BTW Thanks for publishing the link. I am not allowed to do so yet.
 
So that code for BasInitClass is just BasInitClasses?
 
So that code for BasInitClass is just BasInitClasses?
Yes, basInitClass (singular) should not exist. I should have said basInitClasses the first time. BTW I correct these things as you the reader find them, export the new stuff to a PDF and push it into GitHub so your change is now live for the next person. Thanks again.

LOL, I pushed the database file, not the pdf. NOW the pdf should be live.
 
I know it starts small on the database file on disk and expands it as required. It may be running into this. If I go back and restart the wizard does it pickup using the current file size on disk or start all over?

In fact I just realized that my c: drive only has 90 gb left. I may need to tell SQL Server to put the database out on my e: drive where I have much more room.
Is your last post meant to be posted here?
 
If that is addressed to me, I am taking it in small steps, plus I had a Teams meeting this afternoon.
 
John,
Is this correct? Seems to me with the other controls label should be lblTxtDemo ?

Drag and drop one Text Box onto the form. Name the text box txtDemo. Name it’s
associated label lblTxtBoxDemo
 Drag and drop one Combo Box. Name the combo box cboDemo. Name its
associated label lblCboDemo.
 
John,
Is this correct? Seems to me with the other controls label should be lblTxtDemo ?
Yes it should be named to match the text box. It doesn't matter a great deal but still, good catch!

I have found the error and edited it in the book. Pushed to GitHub etc.

Sorry I didn't get back sooner I am juggling a couple of things right now.
 
Yes it should be named to match the text box. It doesn't matter a great deal but still, good catch!

I have found the error and edited it in the book. Pushed to GitHub etc.

Sorry I didn't get back sooner I am juggling a couple of things right now.
No rush, and perhaps hold off on every little error.
I have got as far as Page 27, but my form is not invoking the class, and I am trying to see where I went wrong. :(
 
Hi John,

I'm a big fan of classes and I'm enjoying your work so far.
One thing I noted was in the very beginning you have a timer class which uses an Api. I run 32 bit at home and 64 bit in the office. Had to change the dec's use it.

Code:
#If VBA7 And Win64 Then
    ' Declare for 64-bit Office
    Private Declare PtrSafe Function apiGetTime Lib "winmm.dll" Alias "timeGetTime" () As LongPtr
    Private lngStartTime As LongPtr

#Else
    ' Declare for 32-bit Office (or older VBA versions)
    Private Declare Function apiGetTime Lib "winmm.dll" Alias "timeGetTime" () As Long
    Private lngStartTime As Long

#End If
 
It seems I may have gone wrong. To get the form to even know about the class we need a form. Inside of the form in the header we need global dim. The thing is that while we can create the class before we tell the form about the class, we can't put a reference to the class into the form until the class exists or the compile will complain that it can't find the class... obviously

So I need to stop after creating class form and get that hooked into the form. Let me do that now...

I think I launch right into another class. My bad
 

Users who are viewing this thread

Back
Top Bottom