Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 6 > BOOK: Beginning C# 6.0 Programming with Visual Studio 2015
Password Reminder
Register
Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 14th, 2016, 02: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.
Reply With Quote
  #2 (permalink)  
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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07:44 AM
chapter 14 vthunder70 BOOK: Beginning ASP.NET 2.0 and Databases 2 October 3rd, 2007 02:11 PM



All times are GMT -4. The time now is 01:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.