Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Convert Visual Basic to Visual C++

Convert Visual Basic to Visual C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ido233
    wrote on last edited by
    #1

    Hi everyone What I have is a vb program that I am converting to visual C++ iv done most of the convert but am having a problem with this one. All I want to do is when my VC++ program runs that it show the current Month Day Year in seperate boxes here is the vb code. Public Sub today() 'Get today's date from system Dim currentdate, tempDay, tempMonth, tempYear As String Dim tempDate As String Dim location, StrLen As Integer Dim convert_month As String tempDate = Date$ tempMonth = Month(CDate(tempDate)) tempDay = Day(CDate(tempDate)) tempYear = Year(CDate(tempDate)) currentdate = tempMonth & "/" & tempDay & "/" & tempYear StrLen = Len(currentdate) location = InStr(currentdate, "/") txtMonth.Text = Left(currentdate, location - 1) convert_month = Convert_Date_Int2Str(txtMonth.Text) txtMonth.Text = convert_month currentdate = Right(currentdate, StrLen - location) location = InStr(currentdate, "/") txtDay.Text = Left(currentdate, location - 1) currentdate = Right(currentdate, 2) If (CInt(currentdate) < 90) Then txtyear.Text = "20" & currentdate Else txtyear.Text = "19" & currentdate End If ' End Sub any help is appreciated :omg:

    B 1 Reply Last reply
    0
    • I ido233

      Hi everyone What I have is a vb program that I am converting to visual C++ iv done most of the convert but am having a problem with this one. All I want to do is when my VC++ program runs that it show the current Month Day Year in seperate boxes here is the vb code. Public Sub today() 'Get today's date from system Dim currentdate, tempDay, tempMonth, tempYear As String Dim tempDate As String Dim location, StrLen As Integer Dim convert_month As String tempDate = Date$ tempMonth = Month(CDate(tempDate)) tempDay = Day(CDate(tempDate)) tempYear = Year(CDate(tempDate)) currentdate = tempMonth & "/" & tempDay & "/" & tempYear StrLen = Len(currentdate) location = InStr(currentdate, "/") txtMonth.Text = Left(currentdate, location - 1) convert_month = Convert_Date_Int2Str(txtMonth.Text) txtMonth.Text = convert_month currentdate = Right(currentdate, StrLen - location) location = InStr(currentdate, "/") txtDay.Text = Left(currentdate, location - 1) currentdate = Right(currentdate, 2) If (CInt(currentdate) < 90) Then txtyear.Text = "20" & currentdate Else txtyear.Text = "19" & currentdate End If ' End Sub any help is appreciated :omg:

      B Offline
      B Offline
      bcemick
      wrote on last edited by
      #2

      If I understand this correctly, you just want to grab the current time and display it in edit boxes. To display the entire date in a single box: (editcontrolstring is the CString variable associated with the edit box.) CTime tDate = CTime::GetCurrentTime(); CString strDate = tDate.Format( "%B %d, %Y" );//This will give you month day, year _editcontrolstring_ = strDate; Now, to break it down a little more, you can do something like this: CTime tDate = CTime::GetCurrentTime(); CString strDate = tDate.Format( "%B" );//This gives the month _editcontrolmonthstring_ = strDate; strDate = tDate.Format( "%d" );//This gives the day _editcontroldaystring_ = strDate; And so on.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups