title: Message box for wrong value
body: <p>Im doing a project on vb.net where I have to determine the number of days in a month and wether the given year is leap or not. All the coding is complete for that. All I cannot do is the coding for a message box that will appear if the month is thped incorrectly. </p>
  
  <pre><code>Dim year, days As Double
  Dim leap As Boolean
  Dim monthint As Integer
  Dim monthstr As String
  
  days = 0
  leap = False
  
  year = txtTheyear.Text
  monthstr = txtThemonth.Text
  
  If monthstr = "January" Then
      monthint = 1
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  If monthstr = "February" Then
      monthint = 2
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  If monthstr = "March" Then
      monthint = 3
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "April" Then
      monthint = 4
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "May" Then
      monthint = 5
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "June" Then
      monthint = 6
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "July" Then
      monthint = 7
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "August" Then
      monthint = 8
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "September" Then
      monthint = 9
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "October" Then
      monthint = 10
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "November" Then
      monthint = 11
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  End If
  
  
  
  If monthstr = "December" Then
      monthint = 12
      leap = Date.IsLeapYear(year)
      days = System.DateTime.DaysInMonth(year, monthint)
  
      Lstbx1.Items.Add(year)
      Lstbx1.Items.Add(leap)
      Lstbx1.Items.Add(days)
  
  End If
  
  
  
  
  
  With Lstbx1.Items
      .Clear()
      .Add("Year" &amp; vbTab &amp; vbTab &amp; "Is it a leap year" &amp; vbTab &amp; "Month" &amp; vbTab &amp; "Number of days")
      .Add("----" &amp; vbTab &amp; vbTab &amp; "-----------------" &amp; vbTab &amp; "-----" &amp; vbTab &amp; "--------------")
      .Add(txtTheyear.Text &amp; vbTab &amp; vbTab &amp; leap &amp; vbTab &amp; vbTab &amp; txtThemonth.Text &amp; vbTab &amp; days)
  End With
  </code></pre>
  
  <p>Coding that ive tried for a message box:</p>
  
  <pre><code>If monthstr= "January" or "February" ...
  Then ...
  Else MsgBox ("Type the month correctly")
  End if
  </code></pre>