Learning is not attained by chance, it must
be sought for with ardor and diligence.
-Abigail Adams
 
Home   News   Courses   Tips   Templates   Forums   Help   Order   Contact   Logon  
 
NEW: Excel Expert 11 - Learn XLOOKUP    dismiss
Tips & Tricks

New Tips Added Weekly!
Click here to get on our Mailing List

   
 
VB.NET

Radio Button Value

How to get the value of a Radio Button label and use it in code.

I spent quite a bit of time trying to figure out how to get the Label text from a Radio Button and use it in my Code.

I wanted to change the type of Chart that was being displayed and wanted the user to have a set of options.

Add a Frame onto your Form. (GroupBox1)

	Dim rButton As RadioButton
	rButton = GroupBox1.Controls.OfType(Of RadioButton)()
		.Where(Function(r) r.Checked = True).FirstOrDefault()
	ChosenChart = rButton.Text
	Chart1.Series(Series1.Name).ChartType = 
		[Enum].Parse(GetType(SeriesChartType), ChosenChart)
	

I tried the following but it didn't work.

	'Chart1.Series(Series1.Name).ChartType = CType(ChosenChart, SeriesChartType)
	

Working With Charts? Add the following class.

	Imports System.Windows.Forms.DataVisualization.Charting
	

Research

I found the following article which helped.

	Chart1.Series(Series1.Name).ChartType = 
		DirectCast([Enum].Parse(GetType(SeriesChartType), ChosenChart, True), SeriesChartType)
	

 

Alex Hedley (Avatar) By: Alex Hedley


Click here to sign up for more FREE tips

 

 

Learn
 
Accessindex
Excelindex
Wordindex
Windowsindex
PowerPointindex
Photoshopindex
Visual Basicindex
ASPindex
Seminars
More...
Customers
 
Account Login
Online Theater
Downloads
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Articles
Search The Site
Waiting List
Production Schedule
Collapse Menus
Help
 
Live Chat
Customer Support
WalkThru Tutorials
Troubleshooting
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Order
 
Video Tutorials
Handbooks
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Gift CDs
Contact
 
Live Chat
General Info
Support Policy
Contact Form
Email Richard
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

YouTube Channel    LinkedIn

Blog RSS Feed