Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dos App to Windows Application 4

Status
Not open for further replies.

Leibniz

Programmer
Dec 22, 2007
25
CA
i have converted recently a dos program to a windows program using dialog box for interface but however due to the event driven nature of win32 programming (win32 API programming) i'm geting some dfficulties converting some part of the program, here is an example of a simple algorithm that ressembles closely enough what i am trying to do:

Code:
1)NO KEYWORD WAS FOUND FOR THIS INPUT, PLEASE ENTER A KEYWORD
2)SO THE KEYWORD IS: (key)
3)(if response is no)PLEASE RE-ENTER THE KEYWORD (go back to step #2)
4)NO RESPONSE WAS FOUND FOR THIS KEYWORD: (key) , PLEASE ENTER A RESPONSE
5)SO, THE RESPONSE IS: (resp)
6)(if response is no) PLEASE REENTER THE RESPONSE (go back to step #4)
7)KEYWORD AND RESPONSE LEARNED SUCCESSFULLY
8)IS THERE ANY OTHER KEYWORD THAT I SHOULD LEARN
9)(if response is yes, otherwise continue chating): PLEASE ENTER THE KEYWORD (go back to step #2)

the part i am geting problems with is how to force the application to wait for inputs in the approriate moments.
 
You will probably need to play with the timer control. At the end of the timer, you could then look for a response. If no response, restart timer.

If at first you don't succeed, then sky diving wasn't meant for you!
 
I think you need to rethink your logic as what you are describing is a do it and wait on it approach while VB being an event driven language could do all of that under one event or several. Basically, use a form to host the controls that will accept the information. Then use a button to validate the information...



Good Luck

 
Do as vb5prgrmr suggests, or if you need to validate each entry, do it in the AfterUpdate events of each control.

You don't have to "wait" for inputs. What you need to do is figure out at which events you want the next thing in your program to occur. In DOS programs everything happens in the same order (enter First Name, enter Last Name, etc.). On a Windows form there is no particular order. Therefore you have to stop thinking in terms of "what happens first, what happens second, etc.". Instead you to have to think "what happens if the user does this, or that or the other" and write code in those events.

Don't try to recreate the same flow as DOS code, or you will create a really weird Windows app. Instead, think of what functionality you need the Windows app to do and code to those requirements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top