Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

RE: [V8i VBA] Passing Listbox reference to class, different to a module?

$
0
0

I'm not sure why I had it that way, I guess I must have followed an incorrect code suggestion when learning more about classes. Oddly enough though, the code arrangement worked without any problems but I've amended it as per your suggestion.

I have also managed to determine why I was getting the invalid use of null error though it was down to a single line of code in a control that I had completely forgotten about. As can be seen in the image of the form in a previous reply, I have a button with the caption Go! which is what I use to create an instance of my text creation class. As you are aware, after a class which implements IPrimitiveCommandEvents has been instantiated and the Start event is completed, it awaits a data point to continue. My class is started via:

Public Sub PlaceText()
Set m_ClsTextPlacer = New ClsTextPlacer
m_ClsTextPlacer.WorksheetCount = nWorksheets
CommandState.StartPrimitive m_ClsTextPlacer
End Sub

however my Go! button code was coded as:

Private Sub Btn_InsertText_Click()
Me.Hide
PlaceText
Unload Me
End Sub

So when the class is awaiting a data point, the form is immediately unloaded! I had forgotten I had written it to unload the form automatically instead of merely hiding it. I have now removed the offending line as it already exists within the exit button. As such I can now access the listbox values and create text element with formatting values stored in the listboxes as I was intending:

Thanks once again for your assistance.


Viewing all articles
Browse latest Browse all 7260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>