473,625 Members | 3,254 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 5842
Dom
On Apr 22, 2:51*pm, Tammy Nejadian
<TammyNejad...@ discussions.mic rosoft.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.mic rosoft.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.mi crosoft.comwrot e:
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(in t QuestionNumber) ;

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

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

then ShowQuestion(cu rrentQuestionNu mber) can do something like:

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

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

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
CorrectAnswerNu mber - 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.mic rosoft.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.mi crosoft.comwrot e:
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(in t QuestionNumber) ;

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

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

then ShowQuestion(cu rrentQuestionNu mber) can do something like:

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

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

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
CorrectAnswerNu mber - 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.mic rosoft.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 until the length of the two textbox greather than zero) Any ideas how to do it ?
2
1661
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 fine. If i press the enter key through my keybord, it is going to next page, but functionality is not what i am expecting.
2
9099
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 anyone please help me with this? I am attaching my code piece. Thank you in advance for your help. Wing
2
2623
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 (not only including google which perform general search but other sites which perform seach on a particular type of item in their database) then many search results are obtained (for example more than 100 or even more than 1000) but only limited...
22
2074
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! DoCmd.OpenForm stDocName, , , stLinkCriteria This works really well except that, as expected, I can't add new records. Interestingly, you can click the "next record" button and it will show a blank form (and then grey out) but the Entrainment_ID goes blank...
1
1146
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
6867
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 button text should be changed to something else. For example, "Continue to step 5". Is it possible? Here is my code for generating steps: ============================== Protected Sub HitRaterWiz_Init(ByVal sender As Object, ByVal e As
0
1443
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
903
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 the other record. below is the code; this is for the next button Private Sub nextcmd_Click() If rs.RecordCount > 0 Then rs.MoveNext
0
8189
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8356
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7184
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2621
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 we have to send another system

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.