Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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
 
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


 
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





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





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