Click here to Skip to main content
15,921,840 members
Home / Discussions / C#
   

C#

 
GeneralRe: How i implement Strategy Design pattern in following case Pin
pekhaleyogesh4-Feb-10 0:25
pekhaleyogesh4-Feb-10 0:25 
AnswerRe: How i implement Strategy Design pattern in following case Pin
Not Active4-Feb-10 1:55
mentorNot Active4-Feb-10 1:55 
GeneralRe: How i implement Strategy Design pattern in following case Pin
pekhaleyogesh4-Feb-10 2:21
pekhaleyogesh4-Feb-10 2:21 
GeneralRe: How i implement Strategy Design pattern in following case Pin
pekhaleyogesh4-Feb-10 2:30
pekhaleyogesh4-Feb-10 2:30 
GeneralRe: How i implement Strategy Design pattern in following case Pin
Not Active4-Feb-10 2:41
mentorNot Active4-Feb-10 2:41 
Questiontying an event to dynamically created radio buttons [Solved] Pin
Wamuti3-Feb-10 22:38
Wamuti3-Feb-10 22:38 
AnswerRe: tying an event to dynamically created radio buttons Pin
Zar Ni3-Feb-10 22:57
Zar Ni3-Feb-10 22:57 
AnswerRe: tying an event to dynamically created radio buttons Pin
Luc Pattyn4-Feb-10 0:14
sitebuilderLuc Pattyn4-Feb-10 0:14 
Hi,

1.
you don't really need radiobutton events for this, as you already are using a "Done" button; all you need to do inside the buttonDone_Click handler, is interrogate those radiobuttons, maybe like so:

for(int i=0; i<tbp2.Controls.Length; i++) {
    RadioButton rb=tbp2.Controls[i] as RadioButton;
    if (rb.Checked) Console.WriteLine("RadioButton "+i+" was checked");
}


2.
I would do a couple of things differently, such as:
- instead of using some 1-dimensional and 2-dimensional array of strings, I would create a little Question class, that holds one question, all possible answers, and the correct index. It is more object-oriented that way.
- Then add instances of Question to a list of Questions.
- This would allow for a variable number of answers per question, provided you generate your RadioButtons also in a foreach loop, instead of with straight code.
- and I would consider storing all questions in a database...

Smile | :)

Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.
[The QA section does it automatically now, I hope we soon get it on regular forums as well]


Questioncreate LogError file(C# Coding) [modified] for WindowsApplication Pin
jojoba20103-Feb-10 22:06
jojoba20103-Feb-10 22:06 
AnswerRe: create LogError file(C# Coding) Pin
Zar Ni3-Feb-10 22:16
Zar Ni3-Feb-10 22:16 
QuestionRe: create LogError file(C# Coding) Pin
jojoba20103-Feb-10 22:38
jojoba20103-Feb-10 22:38 
AnswerRe: create LogError file(C# Coding) Pin
Zar Ni3-Feb-10 22:42
Zar Ni3-Feb-10 22:42 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Wamuti3-Feb-10 23:00
Wamuti3-Feb-10 23:00 
QuestionRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
jojoba20103-Feb-10 23:55
jojoba20103-Feb-10 23:55 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Luc Pattyn4-Feb-10 0:18
sitebuilderLuc Pattyn4-Feb-10 0:18 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Zar Ni4-Feb-10 13:41
Zar Ni4-Feb-10 13:41 
AnswerRe: create LogError file(C# Coding) [modified] for WindowsApplication Pin
Pr@teek B@h!5-Feb-10 3:37
Pr@teek B@h!5-Feb-10 3:37 
QuestionDatagridview Focus to specific cell Pin
Vijjuuu.3-Feb-10 21:02
Vijjuuu.3-Feb-10 21:02 
AnswerRe: Datagridview Focus to specific cell Pin
Eddy Vluggen3-Feb-10 21:34
professionalEddy Vluggen3-Feb-10 21:34 
GeneralRe: Datagridview Focus to specific cell Pin
Vijjuuu.4-Feb-10 1:11
Vijjuuu.4-Feb-10 1:11 
GeneralRe: Datagridview Focus to specific cell Pin
Eddy Vluggen4-Feb-10 1:32
professionalEddy Vluggen4-Feb-10 1:32 
GeneralRe: Datagridview Focus to specific cell Pin
Vijjuuu.4-Feb-10 2:09
Vijjuuu.4-Feb-10 2:09 
QuestionImage opacity in C# Pin
VCsamir3-Feb-10 20:45
VCsamir3-Feb-10 20:45 
AnswerRe: Image opacity in C# Pin
Nuri Ismail3-Feb-10 21:29
Nuri Ismail3-Feb-10 21:29 
GeneralRe: Image opacity in C# Pin
VCsamir3-Feb-10 23:09
VCsamir3-Feb-10 23:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.