Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 422
  • Last Modified:

I am getting a Object warning with my select case statement.

I am getting the following warning:

Operands of type Object used in expressions for 'Select', 'Case' statements; runtime errors could occur.


Here is the code that is causing the Warning:
It is on this line: "Select Case Me.lstMemberDescription.SelectedItem"

    Private Sub dtpJoinDate_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)

        If Me.lstMemberDescription.SelectedIndex > -1 Then
            Select Case Me.lstMemberDescription.SelectedItem
                Case "Organizational Member"
                    Me.dtpCancelDate.Value = Now
                Case "Ovation Voter"
                    Me.dtpCancelDate.Value = Now
                Case "Subscription only"
                    Me.dtpCancelDate.Value = DateAdd(DateInterval.Year, 2, Me.dtpJoinDate.Value)
                Case Is <> "Ovation Voter", Is <> "Organizational Member", Is <> "Subscription only"
                    Me.dtpCancelDate.Value = DateAdd(DateInterval.Year, 1, Me.dtpJoinDate.Value)
            End Select
        End If

    End Sub

How would I fix this warning?

Thanks,
0
Richard Comito
Asked:
Richard Comito
  • 2
  • 2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
Hi GabicusC,

shouldn't you use SelectedValue ?

Cheers!
0
 
Richard ComitoDirector of ITAuthor Commented:
emoreau,

I switched to SelectValue but I am still getting the same warning.
0
 
Éric MoreauSenior .Net ConsultantCommented:
I remember now: .Text
0
 
Richard ComitoDirector of ITAuthor Commented:
That is it.  Thanks emoreau!
0

Featured Post

Technology Partners: 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!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now