Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Beginning C# 6.0 Programming with Visual Studio 2015
This is the forum to discuss the Wrox book Beginning C# 6.0 Programming with Visual Studio 2015 by Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid; ISBN: 978-1-119-09668-9
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 6.0 Programming with Visual Studio 2015 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 14th, 2016, 03:02 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 14 Computer Player Level

I am working on the card game options screen in Chapter 14. I cannot get the radio button checked for the value I have selected. I select the radio button for the skill level I want and click ok. When I start the program again it's not checked. I have used debug and as far as I can tell the value is beginning saved and retrieved but the button isn't being checked. I have looked at the code from the website and I don't see a difference. Below is my radio buttons. I suppose there could be a problem somewhere else but debug shows the correct value beign retrieved.
<RadioButton x:Name="dumbAIRadioButton" Content="Dumb" HorizontalAlignment="Left" Margin="37,41,0,0" VerticalAlignment="Top" Checked="dumbAIRadioButton_Checked"/>

<RadioButton x:Name="goodAIRadioButton" Content="Good" HorizontalAlignment="Left" Margin="37,62,0,0" VerticalAlignment="Top" Checked="goodAIRadioButton_Checked"/>

<RadioButton x:Name="cheatingAIRadioButton" Content="Cheats" HorizontalAlignment="Left" Margin="37,83,0,0" VerticalAlignment="Top" Checked="cheatingAIRadioButton_Checked"/>

Thanks for any help.
 
Old March 26th, 2017, 04:04 PM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2017
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reply

Hi,

I am not sure if you still need an answer to this, but there may be someone with the same problem at some point.

To set a RadioButton to the checked state from the designer or code, you have to set the IsChecked property.

In XAML that would be similar to the following:
Code:
<RadioButton x:Name="dumbAIRadioButton" Content="Dumb" HorizontalAlignment="Left" Margin="37,41,0,0" VerticalAlignment="Top" Checked="dumbAIRadioButton_Checked" IsChecked="True"/>
You would set that property to true on the one you want checked.

Michael




Similar Threads
Thread Thread Starter Forum Replies Last Post
help in chapter 14 please nawar youssef BOOK: Beginning PHP 5.3 3 October 27th, 2011 11:36 PM
Chapter 14, first 'Try It Out' alharlow BOOK: Beginning ASP.NET 4 : in C# and VB 5 March 18th, 2011 05:00 AM
issue traversing from 3 level down to 3 level up in xml eruditionist XSLT 3 September 22nd, 2010 01:32 PM
Chapter 6: Coherence as a JPA second level cache Philip Aston BOOK: Professional Oracle WebLogic Server 0 November 21st, 2009 08:44 AM
chapter 14 vthunder70 BOOK: Beginning ASP.NET 2.0 and Databases 2 October 3rd, 2007 02:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.