|
-
Apr 29th, 2003, 08:42 AM
#1
Thread Starter
I wonder how many charact
Pause code until event fires
I'm building a class that controls the showing of multiple forms that step through a generic sales transaction....
The general scheme is this:
I make a call to the class.... myTransaction.Start()
That class first displays a form to the user to select his sales rep id... once the user clicks the button to identify himself... this form returns back to the class with an instance of salesman.
Then the class displays a form to the user to select a customer.... once that information is entered, it returns back to the class with an instance of a customer...
and so on....
Right now, I am having to implement a Do-While Salesman = Nothing... which loops until the user clicks a button which sets the Salesman to a particular instance. Then the form method returns to the class the salesman...
Is there a better way to handle this? I was thinking perhaps using an event based callback... but I'm not sure how that would work...
Transaction class:
VB Code:
Public Sub Start()
SelectASalesMan.Show 'actually a little more complicated
'since I would use a navigation function to determine where to go
'but this suffices for simplicity sake
'at this point though, the transaction class would resume control back to whomever called it
End Sub
Private Sub SalesManSelected(sender as object, e as system.eventargs) Handles MessageSent
End Sub
-
Apr 29th, 2003, 08:45 AM
#2
You could put all the code you need to pause into a thread. Then you have full control of stopping ,pausing, sleeping, and/or starting the thread when you need to.
-
Apr 29th, 2003, 08:54 AM
#3
Thread Starter
I wonder how many charact
Yea... I was thinking along the lines of threads, but didn't want to have to crack the can until absolutely necessary...
I would need a call that would sleep the thread until an event in another thread fired, singaling the paused thread it was safe to resume... however, how would i pass an object back to a paused thread?
-
Apr 29th, 2003, 09:00 AM
#4
I was wondering the same thing. I think a callback is the term, but I really havent gotten into that one yet . I got a whole book on this stuff, but havent had a chance to read it yet.
-
Apr 29th, 2003, 10:13 AM
#5
If you are always using a form to gather the info then just show it modally, use ShowDialog instead of Show. You can shadow the Dialogresult that the Showdialog function returns too if you want, then you can basically call the form like a function.
-
Apr 29th, 2003, 10:19 AM
#6
Thread Starter
I wonder how many charact
ah... brilliant... that would work in my scenario... i hope someone's paying you BIG bucks...
-
Apr 29th, 2003, 10:40 AM
#7
Thread Starter
I wonder how many charact
Well, if you have a few minutes... how would i successfully implement that....
VB Code:
Private Shadows dialogresult As SalesRep
'
'
'
Protected Overloads Function ShowDialog() As SalesRep
End Function
'?
-
Apr 29th, 2003, 10:52 AM
#8
My website loads slow but here is a bit on this:
http://www.edneeis.com/Code/CustomFormResult.asp
There is a link to a sample app in the top description part.
-
Apr 29th, 2003, 10:58 AM
#9
Thread Starter
I wonder how many charact
Ah handy website there....
Ok... thanks again...
-
Apr 29th, 2003, 11:12 AM
#10
It could use some work and I have a ton of stuff I need to add, but I've been lazy, but thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|