This is my assignment yet i can't work it out. Kindly help me?

Public Class Form1
    Private Sub nudYear_ValueChanged(sender As Object, e As EventArgs) Handles nudYear.ValueChanged
        'convert month and year to int'
        Dim month, year As Integer
        Select Case cmbMonth.Text
            Case "January"
                month = 1
            Case "February"
                month = 2
            Case "March"
                month = 3
            Case "April"
                month = 4
            Case "May"
                month = 5
            Case "June"
                month = 6
            Case "July"
                month = 7
            Case "August"
                month = 8
            Case "September"
                month = 9
            Case "October"
                month = 10
            Case "November"
                month = 11
            Case Else
                month = 12
        End Select
        year = nudYear.Value

        'assign variables to system.datetime function'
        Dim dayinmonth As Integer = System.DateTime.DaysInMonth(year, month)

        'main code'
        ListBox1.Items.Add("Sun" & vbTab & "Mon" & vbTab & "Tues" & vbTab & "Wed" & vbTab & "Thurs" &
                           vbTab & "Friday")
        Dim x, sp, c As Integer, st As String
        x = 1
        Do While x <= dayinmonth
            st = ""
            c = 1
            Do While c <= x
                st = st & c

            c = c + 1
            x = x + 7
    End Sub

Recommended Answers

All 3 Replies


I wonder why you want to develop your own calendar.
There are two controls to help you out: MonthCalendar and DateTimePicker.
And second, what is that case statement doing in your ValueChanged method?
This should be a separate function: month name in month number out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.