Click here to Skip to main content
15,917,616 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need my VB.net to write a file containing the following line
Lines(number of lines you want to replace)="write what you want to replace")

but (OF) is causing problem and now i get the error

Comma, ')',or valid expression continuation expected

Please Help Me
Posted
Comments
Aarti Meswania 10-Apr-13 1:40am    
what you have tried?
post your code
shashank 1068 10-Apr-13 1:50am    
i am trying to delete the string
my code is:
Dim number As String
Dim theFile As String="File path"
Dim Lines() As String=System.Io.file.read all lines("File Path")
Lines(number of lines you want to replace)="write what you want to replace")
System.Io.File.All Lines("File Path",Lines)
End Sub
Aarti Meswania 10-Apr-13 1:55am    
in which line you get error?
please post code of that line and a sample data
without detail no one can help you :)
shashank 1068 10-Apr-13 2:02am    
i am getting an error on following line
Lines(number of lines you want to replace)="write what you want to replace"
and OF is causing problem with an error
Comma, ')',or valid expression continuation expected
Aarti Meswania 10-Apr-13 2:10am    
have write this code???

it sould something like below...
Dim number As Integer = 1
Dim theFile As String="D:\Mytextfile.txt"
Dim Lines() As String = System.Io.file.ReadAllLines(theFile)
Lines(1)= Lines(1).Replace(",","*")

1 solution

 
Share this answer
 
v2
Comments
shashank 1068 10-Apr-13 2:10am    
but these links are all about reading files...but i want to delete the text in textbox...so what to do??
Maciej Los 10-Apr-13 2:14am    
Take a look at this line: "To replace text..."

'WinForms:
sText = Me.TextBox1.Text
sText = Replace(sText, "find", "replacewith")


Is it so hard to read answer to the end?

For another useful links, see updated answer.
shashank 1068 10-Apr-13 2:36am    
thank u for your support but it doesn't work :(
Maciej Los 10-Apr-13 2:41am    
What "doesn't work"? If you want to get solution, please, provide more details. "doesn't work" is not informative at all.
Upgrade your question using "Improve question" widget. Share your code and sortly describe your issue. Specify tag: WinForms, WebControls, WPF?
shashank 1068 10-Apr-13 2:47am    
my code is:
Dim number As String
Dim theFile As String="D:\Backup.txt"
Dim Lines() As String=System.Io.file.read all lines("D:\Backup.txt")
Lines(number of lines you want to replace)="write what you want to replace")
System.Io.File.All Lines("D:\Backup.txt",Lines)
End Sub

and i am getting an error on
Lines(number of lines you want to replace)="write what you want to replace")

TAG= WinForms

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900