JOHN JOHNNNY

JOHN JOHNNNY

  • NA
  • 190
  • 140k

Errors in c#

Oct 19 2014 4:51 PM
Good day
 

Good day

I am trying to add a list of question and answers to my xaml by using a string form code behind (xaml.cs), the textblock is working fine but when i try to implement for the radio buttons i keep getting these errors

"Error 1 'System.Windows.Controls.RadioButton' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type
'System.Windows.Controls.RadioButton' could be found (are you missing a using directive or an assembly reference?) "

xaml

...........

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBlock x:Name="lblQuestion" Height="50" TextWrapping="Wrap" Margin="0,10,0,547"/>
<RadioButton x:Name="radA" Margin="0,65,0,492"/>

<Button Content="Satrt" HorizontalAlignment="Left" Margin="174,488,0,0" VerticalAlignment="Top" Click="Button_Click"/>

</Grid>

xaml.cs

.................

int score = 0;
int i = -1;
int a = 0;

string[] questions = new string[]
{
"1. Which Use of English Question Paper Type is given to you?",
"2. According to the writer, the exciting thing about Spaceship Earth is that it ",
"3. The absence of instruction manual in Spaceship Earth has ",
" 4. From the passage, it can be deduced that man ",
"5. The writer's mood in the passage is that of ",
};

string[] answers = new string[] {
"A TypeA ", "B. Type B ", "C. Type C ", "D. Type D ",
"A has no instruction manual ", "B. is not difficult to maintain ", "C. is peculiar to other automobiles ", "D. is relatively easy to operate ",
"A made the operation of the Spaceship Earth difficult. ", "B. forced man to devise other means of travelling in Spacecraft", "C. challenged man's inquisitiveness", "D. made man helpless.",
"A learns by experiment and deduction ","B. learns by chance and accidentally ","C. is incapable of solving all his problems ","D. by his nature is in constant search of knowlege ",
"A non - commital ", "B. pessimism ", "C. optimism ", "D. frOstration ",

};

string[] quizAnswers = new string[] { "A TypeA", "A has no instruction manual", "C. challenged man's inquisitiveness", "A learns by experiment and deduction", "C. optimism ", };

private void Button_Click(object sender, RoutedEventArgs e)
{
if (i < questions.Length)
i++;
//txtScore.Text = score;

lblQuestion.Text = questions[i];

radA.Text = answers[a];     
a
++;
radB
.Text = answers[a];
a
++;
radC
.Text = answers[a];
a
++;
radD
.Text = answers[a];
a
++;



}

Regards and reply soon


Answers (1)