Event Driven Form
-
This is what I have currently: (1) My form (2) My menu bar with all the clicks I want on it (3) A text box docked at the bottom of the form This is what I'd like to happen: (1) On launch of the program - (i) I'd like for the program to ask a question, such as "What is your name?" (2) On the answer of that question based upon input from the text box (i) The first question to disappear (ii) A second question to replace the first question But I don't know how to make the text box docked to the bottom of the form input the text into the application and make the application continue to accept the responses and keep replacing the original question with a new question, etc. Can anyone help me with this?
-
This is what I have currently: (1) My form (2) My menu bar with all the clicks I want on it (3) A text box docked at the bottom of the form This is what I'd like to happen: (1) On launch of the program - (i) I'd like for the program to ask a question, such as "What is your name?" (2) On the answer of that question based upon input from the text box (i) The first question to disappear (ii) A second question to replace the first question But I don't know how to make the text box docked to the bottom of the form input the text into the application and make the application continue to accept the responses and keep replacing the original question with a new question, etc. Can anyone help me with this?
So you are trying to build a wizard type application. Presumably you have the main form appear when you run the program. Some things you will need. A list of questions A list of expected responses/validation rules (eg ask name and get back numbers) Somewhere to store these usually a database or an XML file Some mechanism that tells you where you are in the list (index will do) A container for responses, List will do. Flow Form opens Populate the question list Set the current index to 0 -----------repeat here display the text in a label for the question in list[0] when the user clicks NEXT button validate the text in the textbox store the response in the response List increment the current index and repeat until all questions are responded to. deal with the list of responses, store the info in your preferred device. You then need to address the back operation as well (then the index is decreased clear all responses above the current one)
Never underestimate the power of human stupidity RAH
-
This is what I have currently: (1) My form (2) My menu bar with all the clicks I want on it (3) A text box docked at the bottom of the form This is what I'd like to happen: (1) On launch of the program - (i) I'd like for the program to ask a question, such as "What is your name?" (2) On the answer of that question based upon input from the text box (i) The first question to disappear (ii) A second question to replace the first question But I don't know how to make the text box docked to the bottom of the form input the text into the application and make the application continue to accept the responses and keep replacing the original question with a new question, etc. Can anyone help me with this?
Hi Teknowizard, I am going to take your "ui" description literally and assume you really want to display a single question at a time, and I'm going to assume that you intend for the question to be displayed in the main area of the form (i.e., independently of the textbox docked to the bottom). Please correct me if that interpretation is not right. So you have some method of showing one-question-a-time (textbox ?). Maybe you have a timer controlling how long the question is visible ... whatever. Now the user is typing their answer in the textbox : you are going to monitor the user's actions in the TextBox and at some point change the question. There are many ways to do this, and I'll give you a few hints about design choices you can make with your user input textbox : 1. Multiline property of TextBox : will it be single-line or multi-line 2. AcceptsReturn property of TextBox : what will happen when the user hits the Enter key ? 3. AcceptsTab property of TextBox : what if the use enters tab ? 4. WordWrap property of the TextBox : if multi-line do you want to allow wrapping ? Once you have experimented with and familiarized yourself with these properties, you can move on to Events of the TextBox. Note that you could, by setting KeyPreview property of the hosting Form to true, handle key down/up/press events at the Form level. I suggest you examine the following Events : 1. KeyDown 2. KeyUp 3. KeyPress And consider the issue of what if the user clicks outside the TextBox : do you wish to make the Focus be restrained so the only thing the user can do is type in the TextBox : examine Events : 1. Enter 2. Leave If you wish the user to "signal" when they are done entering an answer by some keyboard activity, you are going to need to write a Key Event Handler : start writing one now, and mess around with it, get familiar with KeyCode and/or KeyData properties of the EventArgs passed to a Key Event. If you wish the user to "signal" they are done by some other means, well, up to you. A few hours now of experimenting will pay big dividends for you in the future. best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and
-
Hi Teknowizard, I am going to take your "ui" description literally and assume you really want to display a single question at a time, and I'm going to assume that you intend for the question to be displayed in the main area of the form (i.e., independently of the textbox docked to the bottom). Please correct me if that interpretation is not right. So you have some method of showing one-question-a-time (textbox ?). Maybe you have a timer controlling how long the question is visible ... whatever. Now the user is typing their answer in the textbox : you are going to monitor the user's actions in the TextBox and at some point change the question. There are many ways to do this, and I'll give you a few hints about design choices you can make with your user input textbox : 1. Multiline property of TextBox : will it be single-line or multi-line 2. AcceptsReturn property of TextBox : what will happen when the user hits the Enter key ? 3. AcceptsTab property of TextBox : what if the use enters tab ? 4. WordWrap property of the TextBox : if multi-line do you want to allow wrapping ? Once you have experimented with and familiarized yourself with these properties, you can move on to Events of the TextBox. Note that you could, by setting KeyPreview property of the hosting Form to true, handle key down/up/press events at the Form level. I suggest you examine the following Events : 1. KeyDown 2. KeyUp 3. KeyPress And consider the issue of what if the user clicks outside the TextBox : do you wish to make the Focus be restrained so the only thing the user can do is type in the TextBox : examine Events : 1. Enter 2. Leave If you wish the user to "signal" when they are done entering an answer by some keyboard activity, you are going to need to write a Key Event Handler : start writing one now, and mess around with it, get familiar with KeyCode and/or KeyData properties of the EventArgs passed to a Key Event. If you wish the user to "signal" they are done by some other means, well, up to you. A few hours now of experimenting will pay big dividends for you in the future. best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and
Take the jar of baby food out of the cupboard get a pan of water remove lid from jar fill the pan 1/2 full heat on stove with the jar in the water get a spoon from cutlery draw when baby food is warm remove from the pan use spoon to scoop some out feed yourself It's a joke Bill, a joke, honest it's a joke.....
Never underestimate the power of human stupidity RAH
-
Take the jar of baby food out of the cupboard get a pan of water remove lid from jar fill the pan 1/2 full heat on stove with the jar in the water get a spoon from cutlery draw when baby food is warm remove from the pan use spoon to scoop some out feed yourself It's a joke Bill, a joke, honest it's a joke.....
Never underestimate the power of human stupidity RAH
Hi Mycroft, I don't know why I'm laughing :), but fully agree : that's funny ! My philosophy is : "why help a man to scream, when you can show him how to damn himself for all eternity." best, Bill p.s. there I was patting myself on the head (the one on my shoulders, I mean) for having done what I thought was a helpful thing. I thought, to use your metaphor, that I was telling the OP : "here's what you need to explore in order for your 'wisdom teeth' to come in so you can 'graduate' from pabulum."
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
-
Hi Mycroft, I don't know why I'm laughing :), but fully agree : that's funny ! My philosophy is : "why help a man to scream, when you can show him how to damn himself for all eternity." best, Bill p.s. there I was patting myself on the head (the one on my shoulders, I mean) for having done what I thought was a helpful thing. I thought, to use your metaphor, that I was telling the OP : "here's what you need to explore in order for your 'wisdom teeth' to come in so you can 'graduate' from pabulum."
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844
It's a slow afternoon here and I seem to recall a Lounge rant against rude responders where you were given a hard time. It struck me a hilarious to see you attempting to spoon feed this person. If I have you mixed up then I apologise but the rant and some of the reactions (Chris's reply sticky) has modified my response pattern, I now have to wait for some idiot to post a programming question in the Lounge to vent my sarcasm on.
Never underestimate the power of human stupidity RAH
-
It's a slow afternoon here and I seem to recall a Lounge rant against rude responders where you were given a hard time. It struck me a hilarious to see you attempting to spoon feed this person. If I have you mixed up then I apologise but the rant and some of the reactions (Chris's reply sticky) has modified my response pattern, I now have to wait for some idiot to post a programming question in the Lounge to vent my sarcasm on.
Never underestimate the power of human stupidity RAH
Hi MyCroft, Yep, you got me mixed up with someone else; I was the author of a strongly worded post[^] on the Site forum stating I believed people were frequently using requests for help to "take a dump on" posters on the technical forums, and this was hurting CodeProject, and was (is) just nasty pieces of work with no redeeming value. Chris came out with the new guidelines soon after my post : of course, however, I do not believe my post was the "cause" of acton by Chris : I think he was hearing from many people on this same issue. Don't you remember when you were a "newbie" in some technical arena, and you really didn't want someone to write your code for you, but you did need some pointing to what was really important to focus on so that you developed your understanding, were enabled to solve many problems, rather than just get a "quick fix" for a specific case you were not making progress with ? When people have kindly replied to me here with helpful pointers when I have been stuck, I've always experienced that as "helpful enabling," not "spoon-feeding." As I said in my long post on the Site forum : I'd like to see CodeProject, my favorite site in the whole world :), my faithful old friend, my galaxy of revered gurus and teachers, have the same dynamic, evolving, kind of "tsunami" of sharing and interaction around problem solving for programmers that I see over on StackOverflow. imho we can contribute to that partially by getting our jollies at our own expense rather than using people we don't know many of whom may not be "native" English speakers. Let us, my friend, disprove the theory of humour espoused in the play "Comedians" by Joe Orton where he has the protagonist say, at one point : "the essence of humour is somebody else gets hurt." best, Bill
"Many : not conversant with mathematical studies, imagine that because it [the Analytical Engine] is to give results in numerical notation, its processes must consequently be arithmetical, numerical, rather than algebraical and analytical. This is an error. The engine can arrange and combine numerical quantities as if they were letters or any other general symbols; and it fact it might bring out its results in algebraical notation, were provisions made accordingly." Ada, Countess Lovelace, 1844