Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

assinging a value to a variable from a combo box selection

$
0
0

hello i'm trying to assign a selection from a combo box to a variable and cant quite get it to work. here is what i have tried.

 'FINDING DAYS IN A GIVEN MONTH'
    Private Sub BmonthTotal(bmonth As Integer)
        Dim birthday As Integer
        'ADDING DAYS OF THE MONTH FOR FEBRUARY 28 OR 29 DAYS'
        If bmonth = 2 Then
            BirthdayCombo.Items.Clear()
            For days As Integer = 1 To 29
                BirthdayCombo.Items.Add(days)
            Next
            'ADDING DAYS FOR APRIL, JUNE, SEPTEMBER, AND NOVEMBER 30 DAYS'
        ElseIf bmonth = 4 Or bmonth = 6 Or bmonth = 9 Or bmonth = 11 Then
            BirthdayCombo.Items.Clear()
            For days As Integer = 1 To 30
                BirthdayCombo.Items.Add(days)
            Next
            ' ADDING DAYS FOR JANUARY, MARCH, MAY, JULY, AUGUST, OCTOBER, AND DECEMBER 31 DAYS'
        ElseIf bmonth = 1 Or bmonth = 3 Or bmonth = 5 Or bmonth = 7 Or bmonth = 8 Or bmonth = 10 Or bmonth = 12 Then
            BirthdayCombo.Items.Clear()
            For days As Integer = 1 To 31
                BirthdayCombo.Items.Add(days)
            Next
        End If
        'TEST'
        If BirthdayCombo.SelectedIndex <> -1 Then
            birthday = BirthdayCombo.SelectedValue
        End If

        LicenseNumber.Text = Val(birthday)
        'END TEST'
    End Sub

i'm using vb 2012 and its a WPF


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>