Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 17th, 2004, 12:03 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Replacing a character with an integer

Hi,

I am quite new to VB.NET. Is there a way to replace a character with an integer. The following is my code but I don't see any change.

Private Sub txtInput_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtInput.TextChanged
        Dim intNum As Integer
        Dim strInput As String
        If (txtInput.Text = "H") Then
            Replace(txtInput.Text, "H", "3")
        End If
    End Sub

I am trying to replace the H with a 3. Any help is greatly appreciated!

Thanks & Regards,
Serene
Reply With Quote
  #2 (permalink)  
Old September 18th, 2004, 12:20 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Replace will return a new string containing the replaced values. This will not change the value of the first parameter. You should write something like this

Dim intNum As Integer
        Dim strInput As String
        If (txtInput.Text = "H") Then
            txtInput.Text = lace(txtInput.Text, "H", "3")
        End If


Reply With Quote
  #3 (permalink)  
Old September 18th, 2004, 12:34 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Chennai, Tamil Nadu, India.
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

Sorry I missed out something...

Read
    txtInput.Text = lace(txtInput.Text, "H", "3")
As
    txtInput.Text = Replace(txtInput.Text, "H", "3")


Ganesh

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help replacing pannels MacDevv C# 0 August 14th, 2006 04:35 AM
Replacing a character from string itHighway Classic ASP Basics 5 March 14th, 2005 11:15 PM
Replacing nbsp delinear Javascript 2 February 5th, 2005 12:22 PM
Replacing tabel civa Access VBA 1 January 24th, 2005 08:41 AM



All times are GMT -4. The time now is 05:16 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.