| | |
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 |
Tag cloud for VB.NET
.net .net2008 2008 access account advanced application array arrays basic beginner browser button buttons center checkbox client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms generatetags gridview html images input intel internet listview map mobile monitor net number objects open panel pdf picturebox picturebox2 port position print printing problem read remove save searchvb.net select serial settings shutdown socket sorting sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter update user usercontol validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode year





