473,499 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Coding NEXT button

I am working with Visual C# window and in my application I need to use a
button ( NEXT) . The button should displays one panel with its objects each
time it clicked. I already developed the codes for creating panels and their
objects which will be questions and their answers. When the NEXT button
clicked it suppose to display first panel with one question and its answers
at a time. When the user selects an answer and click on NEXT button then it
should dismiss the first panel and show the next panel which display the
second question. I coded each panel and its question as a method so method
calls when the button clicked. For example showQuestion1() is first method ,
showQuestion2() is second method… I am new to programming and visual C# so
could you please give me the code with an example.
Thanks,
Tammy

--
Nejadian
Jun 27 '08 #1
8 5832
Dom
On Apr 22, 2:51*pm, Tammy Nejadian
<TammyNejad...@discussions.microsoft.comwrote:
I am working with Visual C# window and in my application I need to use a
button ( NEXT) . The button should displays one panel with its objects each
time it clicked. *I already developed the codes for creating panels and their
objects which will be questions and their answers. When the NEXT button
clicked it suppose to display first panel with one question and its answers
at a time. When the user selects an answer and click on NEXT button then it
should dismiss the first panel and show the next panel which display the
second question. I coded each panel and its question as a method so method
calls when *the button clicked. For example showQuestion1() is first method ,
showQuestion2() is *second method… I am new to programming and visual C# so
could you please give me the code with an example.
Thanks,
Tammy

--
Nejadian
Here is a new direction for you. Instead of panels use a Tab Control,
and each "panel" is then a single tabpage. This, I think, will allow
you to view the "panels" (that is, the tabpages) more quickly in the
Design studio.

The Next button will simply Remove the current tabpage, and Add the
next tabpage. The Previous button will similarly allow the user to
navigate backwards. Furthermore, the title of the tabpage can be used
as a title of the group of questions.

Hope that helps,

Dom
Jun 27 '08 #2
I hate to ask the following, but I forsee this thread going for a while...

Let's look at the bigger picture. Assuming you get the [Next] button to
work as you require, have you considered how you are handling the answer to
the question as selected by the user on the previous panel? Where are you
storing the user's answer? You need to restore this on going back to the
previous question, right?
"Tammy Nejadian" wrote:
I am working with Visual C# window and in my application I need to use a
button ( NEXT) . The button should displays one panel with its objects each
time it clicked. I already developed the codes for creating panels and their
objects which will be questions and their answers. When the NEXT button
clicked it suppose to display first panel with one question and its answers
at a time. When the user selects an answer and click on NEXT button then it
should dismiss the first panel and show the next panel which display the
second question. I coded each panel and its question as a method so method
calls when the button clicked. For example showQuestion1() is first method ,
showQuestion2() is second method… I am new to programming and visual C# so
could you please give me the code with an example.
Thanks,
Tammy

--
Nejadian
Jun 27 '08 #3
You are correct! I did not think about handeling the answers. I added Check
boxes and radio buttons and I also displaying the answers so the user can
select one answer however I have no idea how I can collect the answers. Do
you mind to help me with that. Would you please give me the sample example or
some place to search and view more examples?
Thank you very much.
--
Nejadian
"Family Tree Mike" wrote:
I hate to ask the following, but I forsee this thread going for a while...

Let's look at the bigger picture. Assuming you get the [Next] button to
work as you require, have you considered how you are handling the answer to
the question as selected by the user on the previous panel? Where are you
storing the user's answer? You need to restore this on going back to the
previous question, right?
"Tammy Nejadian" wrote:
I am working with Visual C# window and in my application I need to use a
button ( NEXT) . The button should displays one panel with its objects each
time it clicked. I already developed the codes for creating panels and their
objects which will be questions and their answers. When the NEXT button
clicked it suppose to display first panel with one question and its answers
at a time. When the user selects an answer and click on NEXT button then it
should dismiss the first panel and show the next panel which display the
second question. I coded each panel and its question as a method so method
calls when the button clicked. For example showQuestion1() is first method ,
showQuestion2() is second method… I am new to programming and visual C# so
could you please give me the code with an example.
Thanks,
Tammy

--
Nejadian
Jun 27 '08 #4
Dom
On Apr 23, 2:19*pm, Tammy Nejadian
<TammyNejad...@discussions.microsoft.comwrote:
You are correct! I did not think about handeling the answers. I added Check
boxes and *radio buttons and I also displaying the answers so the user can
select one answer however I have no idea how I can collect the answers. Do
you mind to help me with that. Would you please give me the sample exampleor
some place to search and view more examples?
Thank you very much.
--
Nejadian

"Family Tree Mike" wrote:
I hate to ask the following, but I forsee this thread going for a while....
Let's look at the bigger picture. *Assuming you get the [Next] button to
work as you require, have you considered how you are handling the answerto
the question as selected by the user on the previous panel? *Where areyou
storing the user's answer? *You need to restore this on going back to the
previous question, right?
"Tammy Nejadian" wrote:
I am working with Visual C# window and in my application I need to usea
button ( NEXT) . The button should displays one panel with its objectseach
time it clicked. *I already developed the codes for creating panels and their
objects which will be questions and their answers. When the NEXT button
clicked it suppose to display first panel with one question and its answers
at a time. When the user selects an answer and click on NEXT button then it
should dismiss the first panel and show the next panel which display the
second question. I coded each panel and its question as a method so method
calls when *the button clicked. For example showQuestion1() is firstmethod ,
showQuestion2() is *second method… I am new to programming and visual C# so
could you please give me the code with an example.
Thanks,
Tammy
--
Nejadian- Hide quoted text -

- Show quoted text -
If you use the TabControl, you don't need to worry about saving
responses between pages. Just remove one tabpage, and add the
previous tabpage. All the answers are still there. At the end, when
the user hits "Finish", you save all the answers at one time.
Jun 27 '08 #5
On Apr 23, 1:16 pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
I hate to ask the following, but I forsee this thread going for a while...
Well, the OP said he had a panel for each question - so assuming (s)he
isn't destroying the panel as next is pressed, then the selected
answers are still available on the panels.

I dont think methods of ShowQuestion1() ShowQuestion2() is appropriate
- instead have a mehtod ShowQuestion(int QuestionNumber);

Have an array of panels, to which you have added each panel in
sequence.

Have a private field, int currentQuestionNumber; which is initialised
to 1, incremented when the next button is clicked.

then ShowQuestion(currentQuestionNumber) can do something like:

QuestionPanels[currentQuestionNumber].Visible = true;
QuestionPanels[currentQuestionNumber].BringtoFront;
QuestionPanels[currentQuestionNumber].Dock = DockStyles.Fill;

Implementing a Back button does the same as the next button, but
decrements currentQuestionNumber.

Remembering to check for negative, and values greater than the number
of elements in the array of panels.

If, rather than just having panels with questions and answers hard-
coded, you create a user control, containing (say) a label for the
question and 4 checkboxes for the answers, then either create an
instance of this at runtime, and populate the question text and
checkbox text appriopriately, or inherit from this at design time for
each question, then you can also handle this array of usercontrols
(rather than panels) far more easily when getting the answers .

For example, if the user control has a property of int
CorrectAnswerNumber - this can be set to the value (1-4) of the
checkbox which shows teh correct answer.
Depending on if you want to save individual answers, you could have
properties of int SelectedAnswer which returns 1-4 depending on the
answer selected (or zero if nothing selected yet)

Depending on the use, you might want to go more generic - i.e. if
there may be more or less than 4 possible answers.

I did something similar in Uni (although it was far more complex,
reading questions and possible answers from the DB, contaiing
validation rules in the DB, allowing checkboxes, drop down selections
etc. and also allowing picture questions. It was user configurable
(i.e. the administrator could add and remove questions, assign marks
to particular answers etc.) It even had both a web and windows form
front end.

It was in VB .Net

I may still have a copy if you are interested in looking at it - it's
not exactly a best-practices example (it was written by a team of four
2nd year IT students, after all) but it did the job - and we got a 7
(which is maximum marks here in sunny Oz)
Jun 27 '08 #6
Thanks for the suggestion but I have to use panel.
--
Nejadian
"Dom" wrote:
On Apr 23, 2:19 pm, Tammy Nejadian
<TammyNejad...@discussions.microsoft.comwrote:
You are correct! I did not think about handeling the answers. I added Check
boxes and radio buttons and I also displaying the answers so the user can
select one answer however I have no idea how I can collect the answers. Do
you mind to help me with that. Would you please give me the sample example or
some place to search and view more examples?
Thank you very much.
--
Nejadian

"Family Tree Mike" wrote:
I hate to ask the following, but I forsee this thread going for a while....
Let's look at the bigger picture. Assuming you get the [Next] button to
work as you require, have you considered how you are handling the answer to
the question as selected by the user on the previous panel? Where are you
storing the user's answer? You need to restore this on going back to the
previous question, right?
"Tammy Nejadian" wrote:
I am working with Visual C# window and in my application I need to use a
button ( NEXT) . The button should displays one panel with its objects each
time it clicked. I already developed the codes for creating panels and their
objects which will be questions and their answers. When the NEXT button
clicked it suppose to display first panel with one question and its answers
at a time. When the user selects an answer and click on NEXT button then it
should dismiss the first panel and show the next panel which display the
second question. I coded each panel and its question as a method so method
calls when the button clicked. For example showQuestion1() is first method ,
showQuestion2() is second method… I am new to programming and visual C# so
could you please give me the code with an example.
Thanks,
Tammy
--
Nejadian- Hide quoted text -
- Show quoted text -

If you use the TabControl, you don't need to worry about saving
responses between pages. Just remove one tabpage, and add the
previous tabpage. All the answers are still there. At the end, when
the user hits "Finish", you save all the answers at one time.
Jun 27 '08 #7
Actually because of each question has different number of answers I am
creating the label and radio buttons for questions rather than using them
from toolbar. I also should use one panel and display each question and its
related answers. And next question should display when the NEXT button
clicked in same panel. I was not able to display the created label and radio
buttons in the panel from tool bar so I end up to create the panel, label and
check boxes or radio buttons for each question. I think your explanation is
very helpful and the project you had it seems is very close to what I need to
do. If you don’t mind could you please send a copy of that project for me,
the one you did for window? I greatly appreciated your help. I am new in
Visual C# and programming and usually looking at similar example is helping
me a lot. Thanks again.
Tammy

--
Nejadian
".\\\\axxx" wrote:
On Apr 23, 1:16 pm, Family Tree Mike
<FamilyTreeM...@discussions.microsoft.comwrote:
I hate to ask the following, but I forsee this thread going for a while...

Well, the OP said he had a panel for each question - so assuming (s)he
isn't destroying the panel as next is pressed, then the selected
answers are still available on the panels.

I dont think methods of ShowQuestion1() ShowQuestion2() is appropriate
- instead have a mehtod ShowQuestion(int QuestionNumber);

Have an array of panels, to which you have added each panel in
sequence.

Have a private field, int currentQuestionNumber; which is initialised
to 1, incremented when the next button is clicked.

then ShowQuestion(currentQuestionNumber) can do something like:

QuestionPanels[currentQuestionNumber].Visible = true;
QuestionPanels[currentQuestionNumber].BringtoFront;
QuestionPanels[currentQuestionNumber].Dock = DockStyles.Fill;

Implementing a Back button does the same as the next button, but
decrements currentQuestionNumber.

Remembering to check for negative, and values greater than the number
of elements in the array of panels.

If, rather than just having panels with questions and answers hard-
coded, you create a user control, containing (say) a label for the
question and 4 checkboxes for the answers, then either create an
instance of this at runtime, and populate the question text and
checkbox text appriopriately, or inherit from this at design time for
each question, then you can also handle this array of usercontrols
(rather than panels) far more easily when getting the answers .

For example, if the user control has a property of int
CorrectAnswerNumber - this can be set to the value (1-4) of the
checkbox which shows teh correct answer.
Depending on if you want to save individual answers, you could have
properties of int SelectedAnswer which returns 1-4 depending on the
answer selected (or zero if nothing selected yet)

Depending on the use, you might want to go more generic - i.e. if
there may be more or less than 4 possible answers.

I did something similar in Uni (although it was far more complex,
reading questions and possible answers from the DB, contaiing
validation rules in the DB, allowing checkboxes, drop down selections
etc. and also allowing picture questions. It was user configurable
(i.e. the administrator could add and remove questions, assign marks
to particular answers etc.) It even had both a web and windows form
front end.

It was in VB .Net

I may still have a copy if you are interested in looking at it - it's
not exactly a best-practices example (it was written by a team of four
2nd year IT students, after all) but it did the job - and we got a 7
(which is maximum marks here in sunny Oz)
Jun 27 '08 #8
On 2008-04-24, Tammy Nejadian <Ta***********@discussions.microsoft.comwrote:
Actually because of each question has different number of answers I am
creating the label and radio buttons for questions rather than using them
from toolbar. I also should use one panel and display each question and its
related answers. And next question should display when the NEXT button
clicked in same panel. I was not able to display the created label and radio
buttons in the panel from tool bar so I end up to create the panel, label and
check boxes or radio buttons for each question. I think your explanation is
very helpful and the project you had it seems is very close to what I need to
do. If you don?t mind could you please send a copy of that project for me,
the one you did for window? I greatly appreciated your help. I am new in
Visual C# and programming and usually looking at similar example is helping
me a lot. Thanks again.
Tammy
http://www.codeproject.com/KB/dialog/tswizard.aspx

Simple wizard framework - with source, so you can get an idea of one
implementation of what your trying to do.

--
Tom Shelton
Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
349
by: Assaf | last post by:
Hi, I added to my setup project TextBox dialog control which contains two textbox. I want to add the ability to disable the next button until the user enter some text in the textbox (let's say...
2
1650
by: manu_srinivasa | last post by:
:( Hi, I have aspx pages, in all pages i am placing next button, which will take us to next screen. if i click next button with mouse, it is going to next page and functionality is working...
2
9079
by: winnie_us99 | last post by:
Hi All, I am trying to do validation on my text field before going to the next page to create a user. It doesn't look like the next button will fire any validation. Am I missing something? Can...
2
2607
by: Arsalan Ahmad | last post by:
Hi, May be I am a newbie, or may be i dont have that much insight in following systems ..i.e. why i have some confusions as below: In many websites, when search is performed on some keywords...
22
2051
AccessIdiot
by: AccessIdiot | last post by:
Anyone getting sick of me yet? :D I have a button on my form that opens a new form but with a filter: stDocName = "frm_Specimen_Entrainment" stLinkCriteria = "=" & Me! ...
1
1142
by: Ruby jain | last post by:
pleade help me in coding of next buuton .how the data move when press the next button in c#
3
6857
by: M. Ali Qureshi | last post by:
Hi, I have a wizard in my aspx page, and i create steps programatically. There are about 8 steps in all. The default text for StepNextButton is "Next". But i want that only in step 4, the next...
0
1425
by: Ignacio Machin ( .NET/ C# MVP ) | last post by:
On Apr 22, 2:51 pm, Tammy Nejadian <TammyNejad...@discussions.microsoft.comwrote: Do a search in the archives of this NG, look for "wizard" you will find a lot of examples
0
901
by: noora mohammed | last post by:
Hi, i am using acees 2007 with vb. i have records stord there and i want to view them through my application by the next and previous buttons, but when i press the next button it will not move to...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.