Click here to Skip to main content
15,888,257 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: StatusStrip is not updating from a class. Pin
Luc Pattyn18-Jun-09 12:01
sitebuilderLuc Pattyn18-Jun-09 12:01 
GeneralRe: StatusStrip is not updating from a class. [modified] Pin
Musa Biralo18-Jun-09 12:17
Musa Biralo18-Jun-09 12:17 
GeneralRe: StatusStrip is not updating from a class. Pin
Luc Pattyn18-Jun-09 13:10
sitebuilderLuc Pattyn18-Jun-09 13:10 
QuestionWaiting for a process to end uses too much CPU. Pin
elajua18-Jun-09 11:50
elajua18-Jun-09 11:50 
AnswerRe: Waiting for a process to end uses too much CPU. Pin
Luc Pattyn18-Jun-09 12:05
sitebuilderLuc Pattyn18-Jun-09 12:05 
GeneralRe: Waiting for a process to end uses too much CPU. Pin
elajua18-Jun-09 14:39
elajua18-Jun-09 14:39 
GeneralRe: Waiting for a process to end uses too much CPU. Pin
Luc Pattyn18-Jun-09 14:52
sitebuilderLuc Pattyn18-Jun-09 14:52 
QuestionAny way to use constructor parameters within "dim as new"? Pin
supercat918-Jun-09 11:38
supercat918-Jun-09 11:38 
I have a class which is supposed to simulate part of a piece of hardware. When the object is created, the constructor is given a reference to the underlying CPU-control object (an object of the class has no meaning without such a base object). The class needs a substantial number of "WithEvents" other objects which need to attach themselves to the underlying CPU control object. For example, "Dim MotorEnable as New IoBit(baseCPU, 4, 6)" will cause any writes to MotorEnable.pin to be visible on bit 6 of port 4 in the base CPU, and will cause any CPU writes to bit 6 of port 4 to trigger a "MotorEnable.PinChanged" event in the hardware-simulation object.

The "Dim XX as New YY(params)" format of declaration is much more appealing than having a separate declaration and initialization. Unfortunately, even though the identity of the new master CPU object is known before all the "Dim XX as New YY()" statements start firing (they fire in response to calling New() with the master object as one of its parameters), as far as I can tell it only exists as a local variable which is not accessible to them.

Is there any clean way to handle such constructs? Possible approaches:

-1- Have the code for the piece of hardware Inherit the base CPU object, and create the new hardware object instead of the base CPU. That would work, but only for the case where there was only one hardware class trying to extend the CPU.

-2- Have the code for the sub-feature objects accept a pointer to an iWillSupplyBase object, which will fire an event that will supply the real base CPU object. If the hardware simulation object implements iWillSupplyBase, it can fire the event within its New() procedure; the sub-feature objects can then attach themselves to the base object at that time.

-3- Use a shared factory method which sets a ThreadStatic reference to the base CPU object and then calls the constructor. The "Dim As New" statements could then pass the ThreadStatic reference to the object constructors. This would probably work fine, but it seems really icky.

-4- Have the simulation object create its own set of port handlers attached to the base CPU, and attach the port pins to those rather than the base CPU. That might be workable, but it seems rather icky, and would add a couple more levels of indirection to all I/O operations.

-5- Give up on the Dim As New syntax, even though it makes much of the code nicer and easier to read.

Is there any other brilliant approach I'm missing?
Questionwhat is the installation steps for windows application project ? Pin
ahlamissa18-Jun-09 10:23
ahlamissa18-Jun-09 10:23 
AnswerRe: what is the installation steps for windows application project ? Pin
EliottA18-Jun-09 10:53
EliottA18-Jun-09 10:53 
AnswerRe: what is the installation steps for windows application project ? Pin
Dave Kreskowiak18-Jun-09 11:28
mveDave Kreskowiak18-Jun-09 11:28 
QuestionScope (?) Problem in Excel VBA Pin
TheConfusedGuy18-Jun-09 9:29
TheConfusedGuy18-Jun-09 9:29 
AnswerRe: Scope (?) Problem in Excel VBA Pin
Dave Kreskowiak18-Jun-09 9:56
mveDave Kreskowiak18-Jun-09 9:56 
QuestionContext Menu Pin
No-e18-Jun-09 6:23
No-e18-Jun-09 6:23 
AnswerRe: Context Menu Pin
Jon_Boy18-Jun-09 6:37
Jon_Boy18-Jun-09 6:37 
GeneralRe: Context Menu Pin
No-e18-Jun-09 12:08
No-e18-Jun-09 12:08 
GeneralRe: Context Menu Pin
Jon_Boy19-Jun-09 6:09
Jon_Boy19-Jun-09 6:09 
AnswerRe: Context Menu Pin
Bahram.Zarrin27-Jun-09 5:14
Bahram.Zarrin27-Jun-09 5:14 
Questionmultipage problem in printpreview? Pin
JC.KaNNaN18-Jun-09 4:03
JC.KaNNaN18-Jun-09 4:03 
AnswerRe: multipage problem in printpreview? Pin
Luc Pattyn18-Jun-09 4:47
sitebuilderLuc Pattyn18-Jun-09 4:47 
GeneralRe: multipage problem in printpreview? Pin
JC.KaNNaN18-Jun-09 22:19
JC.KaNNaN18-Jun-09 22:19 
QuestionEtracting certain text from PDF document into a database Pin
kshincsk18-Jun-09 3:31
kshincsk18-Jun-09 3:31 
AnswerRe: Etracting certain text from PDF document into a database Pin
Dave Kreskowiak18-Jun-09 9:58
mveDave Kreskowiak18-Jun-09 9:58 
GeneralRe: Etracting certain text from PDF document into a database Pin
kshincsk19-Jun-09 0:58
kshincsk19-Jun-09 0:58 
GeneralRe: Etracting certain text from PDF document into a database Pin
Dave Kreskowiak19-Jun-09 4:27
mveDave Kreskowiak19-Jun-09 4:27 

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.