Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Method 'Microsoft.VisualBasic.Strings.Replace' not found.

Status
Not open for further replies.

christer99

IS-IT--Management
Joined
Dec 3, 2001
Messages
247
Getting this error Method 'Microsoft.VisualBasic.Strings.Replace' not found.
in Visual Studio 2005 at compile time.

for this line: propfiles3 = Microsoft.VisualBasic.Strings.Replace(propfiles3, ".dot", "")

Have tried with and without: Imports Microsoft.VisualBasic


 
That works if I only have one replace, but if I replace multiple words from the same file, I am running into an error: The variable 'Propfiles5' is either undeclared or was never assigned.



Propfiles5 = propfiles3.Replace(".dot", "")
Propfiles5 = Propfiles5.Replace("Proposal-PRO", "")
Propfiles5 = Propfiles5.Replace("Proposal-INM", "")
Propfiles5 = Propfiles5.Replace("Proposal-CAST", "")
Propfiles5 = Propfiles5.Replace("Proposal-STAFFING", "")
Propfiles5 = Propfiles5.Replace("Proposal-GASTON", "")
 
Are you sure PropFiles5 is declared?

Code:
Dim s1 As String = "MyString.dot"
Dim s2 As String
s2 = s1.Replace(".dot", "")
s2 = s2.Replace("M","")

works fine for me.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top