Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Unselected radio button list...

Posted on 2004-08-13
3
Medium Priority
?
857 Views
Last Modified: 2008-02-01
When using the following if statement, it works fine if one of hte items is selected...

I'm crashing if none of the radio buttons are selected.

If (rblPart.SelectedItem.Text = "Make Part") Then

Ideas???

Thanks,
0
Comment
Question by:Weller0123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 33

Expert Comment

by:raterus
ID: 11796367
SelectedItem is a reference to the selected listitem, if there isn't a selected value, this is null, which is why you are getting the error.  You need to check to see if this is null or nothing first, then act accordingly
0
 
LVL 15

Accepted Solution

by:
Thogek earned 2000 total points
ID: 11796368
Well, you're trying to access the SelectedItem, which would be a problem is no item is selected....

Perhaps

    If (rblPart.SelectedIndex <> -1) Then
        If (rblPart.SelectedItem.Text = "Make Part") Then
0
 
LVL 8

Expert Comment

by:daffodils
ID: 11796442
Thogek has the right bit of code for you..


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question