3 Replies - 18828 Views - Last Post: 25 August 2010 - 11:01 AM Rate Topic: -----

#1 achieverneha  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-August 10

how to write a program in vb to input a number and get reverse of it

Posted 24 August 2010 - 08:23 AM

how to writa a program in vb o enter a number and get reverse of it
Is This A Good Question/Topic? 0
  • +

Replies To: how to write a program in vb to input a number and get reverse of it

#2 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12043
  • View blog
  • Posts: 44,900
  • Joined: 27-December 08

Re: how to write a program in vb to input a number and get reverse of it

Posted 24 August 2010 - 11:41 AM

The VB Tutorials are an excellent place to start, along with the snippets. Show us your good faith efforts and we will be happy to help you. Also, please note the rules:

[rules][/rules]
Was This Post Helpful? 0
  • +
  • -

#3 kingsonprisonic  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 74
  • Joined: 09-July 09

Re: how to write a program in vb to input a number and get reverse of it

Posted 25 August 2010 - 08:44 AM

Use this function,.....

Public Function rev(ByVal source As String) As String
Dim tmp As String
tmp = ""
Dim i As Integer
For i = 0 To Len(source)
tmp = Mid(source, i + 1, 1) + tmp
Next
rev = tmp
End Function




USE :
MsgBox rev("I am a simple text"), vbOKOnly, "Reverse Is!"

Was This Post Helpful? 0
  • +
  • -

#4 parbipin  Icon User is offline

  • D.I.C Head

Reputation: 29
  • View blog
  • Posts: 95
  • Joined: 23-August 10

Re: how to write a program in vb to input a number and get reverse of it

Posted 25 August 2010 - 11:01 AM

@kingsonprisonic: Your code will return a string and not a number. While the logic is correct. It helps. I have yours slightly modified.



Public Function revNumber(ByVal source As Long) As Long

Dim tmpSource As String, tmp As String
Dim i As Integer
tmpSource = Str(source)
tmp = ""
    For i = 1 To Len(tmpSource)
        tmp = Mid(tmpSource, i + 1, 1) + tmp
    Next
    
revNumber = CLng(tmp)
End Function


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1