| | |
Reverse a String
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2006
Posts: 25
Reputation:
Solved Threads: 1
I'm having trouble reversing a string. Me thinks I've stared at this too long.
Thx
VB.NET Syntax (Toggle Plain Text)
Private Sub btnReverse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReverse.Click Dim strOrgText As String Dim strRevText As String Dim array As Array strOrgText = Me.txtTheString.Text array = strOrgText.ToCharArray() strRevText = array.Reverse 'Here is my problem strRevText = Me.lblResult.Text End Sub
Thx
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
Try this:
VB.NET Syntax (Toggle Plain Text)
Dim input As String = "abc" Dim output As String = "" Dim CharStr As New Char For Each CharStr In input output = CharStr & output Next MessageBox.Show(output)
thats becouse array.Reverse needs an argument and the other thing it does not produce value so you can't assign it to strRevText
here is problem too , here u do not show the result !
after the correction this is ur code
or u can use StrReverse function like this
here is problem too , here u do not show the result !
after the correction this is ur code
Dim strOrgText As String
Dim strRevText As [Char]()
Dim array As Array
strOrgText = Me.txtTheString.Text
strRevText = strOrgText.ToCharArray
array.Reverse(strRevText)
Me.lblResult.Text = strRevTextor u can use StrReverse function like this
VB.NET Syntax (Toggle Plain Text)
Me.lblResult.Text = StrReverse(Me.txtTheString.Text)
"give only what u willing to receive "
![]() |
Similar Threads
- How do you reverse string elements (C++)
- reverse a string using recursion (C)
- Reverse String - Assembly Language (Assembly)
Other Threads in the VB.NET Forum
- Previous Thread: Changing properties of control in Class module
- Next Thread: dropdownlist not firing
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2008 access arithmetic array assignment basic binary bing box button buttons c# center code combobox component connectionstring convert cpu data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dosconsolevb.net editvb.net excel file-dialog firewall folder google hardcopy image images isnumericfuntioncall listview login math memory mobile ms mssqlbackend mysql navigate net networking opacity output pan peertopeervideostreaming picturebox picturebox1 plugin port print printing printpreview problemwithinstallation project record reports" reuse save savedialog serial server sorting sql storedprocedure string structures temp text textbox timer toolbox updown upload useraccounts usercontrol vb vb.net vb.netcode vb.nettoolboxvisualbasic2008sidebar vbnet view visual visualbasic visualbasic.net visualstudio web wpf





