Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute VB.Net Online

Module VBModule
 
    Sub Main()
       MyProfile()
    End Sub
    
    Private Sub MyProfile
    
        Dim num1 As Integer
        Dim num2 As Integer
        Dim mon As String
        num1 = 9
        num2 = 9
        mon="MARCH"
        Dim today As System.DateTime
            
            Console.WriteLine("Hello master Wroyce!")
            Console.WriteLine("How are you? are you still bored?")
  
          
         if today.Today.Month.toString().equals("3") AND today.Today.Day.toString().equals("18")  then
         
         mon ="MAR"
            Console.WriteLine("Your Birthday is: {0} ,{1},{2},{3}", getMonth(mon),calculate(num1,num2),today.Today.Day.ToString(),today.Today.Year.ToString())
            Console.WriteLine("Happy B-day master Wroyce! Have a niceday and more blessing to come. Godbless you!")
            
         ElseIf today.Month.toString() IsNot "3" then
         
         if Convert.toInt32(today.Now.Month) = 1 then
         mon ="JAN"
         Elseif  Convert.toInt32(today.Now.Month) =2 then
         mon ="FEB"
         Elseif Convert.toInt32(today.Now.Month) =4 then
         mon ="APR"
         Elseif Convert.toInt32(today.Now.Month)=5 then
         mon ="MAY"
         Elseif Convert.toInt32(today.Now.Month)=6 then
         mon ="JUN"
         Elseif Convert.toInt32(today.Now.Month)=7 then
         mon ="JUL"
         Elseif Convert.toInt32(today.Now.Month)=8 then
         mon ="AUG"
         Elseif Convert.toInt32(today.Now.Month)=9 then
         mon ="SEP"
         Elseif Convert.toInt32(today.Now.Month)=10 then
         mon ="OCT"
         Elseif Convert.toInt32(today.Now.Month)=11 then
         mon ="NOV"
         Else
         mon ="DEC"
         
         End if
         
         Console.WriteLine("Today it`s not your birthday. This month is {0},{1},{2} ",getMonth(mon),today.Now.Day.ToString(), today.Today.Year.ToString())
         Console.WriteLine("You have  {0} remaining days before your birthday come. You have much time to prepare.", getRemainingDays)
         Console.WriteLine("Are you feeling excited? can you tell me about your ideas? what goals you need to accomplish this year")
         Console.WriteLine("You looking happy today! are you thinking someone?")
         Console.WriteLine("Remaining Hours {0}", getRemainingHour)
         
         End if
         
         End Sub
     
     Private Function calculate(ByVal num1 As Integer ,ByVal num2 As Integer) As Integer
     
     Dim results As Integer
     results = num1 + num2
     return results
     
     End Function
     
     Private Function getMonth(ByVal mon As String) As String
     if mon isNot "MAR" AND mon.equals("JAN") OR mon.equals("FEB") then
     mon = mon+"UARY"
     return mon
     Elseif mon.equals("MAR") then
     mon = mon+"CH"
     return mon
     End if
     return mon
     
     End Function
     
     Private Function getRemainingDays As Integer
     
     Dim current As System.DateTime
     Dim iDate As String = "03/18/2019"
     Dim oDate As DateTime = Convert.ToDateTime(iDate)
     Dim remaining As TimeSpan  =  oDate - current.Today
     return remaining.Days
     End Function
     
     
     Private Function getRemainingHour As Integer
     Dim timeOut As String 
          timeOut = "4:30:00 PM"
     Dim addTime As Double
          addTime = 8.00
     Dim current As System.DateTime
     Console.WriteLine("PH Time:{0} Time Out:{1}",current.Today.Now.AddHours(addTime),timeOut)
     Dim strTimeOut As DateTime =  Convert.ToDateTime(timeOut)
     Dim phTime As System.DateTime = current.Today.Now.AddHours(addTime)
     Dim hourIntervals As TimeSpan = strTimeOut - phTime
     return hourIntervals.Hours
     End Function
     
End Module

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.