sergeysagan Posted September 10, 2003 Posted September 10, 2003 How do I insert the next line character into my txt-based file in Visual BAsic .NET Here is how my code goes: ' Now, finaly lets add the actual link FileOpen(1, LinkFileDir LinkFileName, OpenMode.Input) ' Put the contents of the file into our variable LinkFileValue = InputString(1, LOF(1)) ' Check to see where in the string we need to be. LinkFilePos1 = InStr(1, LinkFileValue, "<tr style='mso-yfti-irow:40;mso-yfti-lastrow:yes'>") ' Manupulate the sting adding our new link LinkFileValue = LinkFileValue.Insert(LinkFilePos1, " ") Now this " " needs to be changed to a carriage return(Next Line, Enter Key, etc.) what would I put, I searched all of VB help and could find out how to do it. (By the way in C it's "/n") Thanks, Serj http://www.enhancementresearch.com Quote
*Experts* Volte Posted September 10, 2003 *Experts* Posted September 10, 2003 You really really should get away from the old VB6 ways of file access. I also see you using InStr() which you should not do. Look at the System.IO namespace for file manipulation functionality that is supported by the .NET Framework, and use LinkFileValue.IndexOf("<tr... etc")instead of that InStr line. Read up on the String class for info on .NET string manipulation. To answer your question, use Environment.NewLine to insert a newline.Dim s As String = "Line1" & Environment.NewLine & "Line2" Quote
Administrators PlausiblyDamp Posted September 10, 2003 Administrators Posted September 10, 2003 Environment.NewLine should give you what you need. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
SourceCoders Posted October 3, 2003 Posted October 3, 2003 Or a other one .... "Line 1" + chr(13) + "Line 2" chr(13) is the code for the "return"-key Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.