Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Line break: vbNewLine vs. vbCrLf vs. vbCr vs. vbLf

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
DRoam
7684 Views, 3 Replies

Line break: vbNewLine vs. vbCrLf vs. vbCr vs. vbLf

I have a vague understanding of what "Cr" (carriage return) and "Lf" (line feed) mean (or, at least, what people on internet forms think they mean)... what I'd like to know is, specifically in Inventor, is there any reason to use (or not use) any of them in particular?

 

I'm asking because I've always used vbnewline but seem to invariably type "vbnewlein" more than half the time.

 

In iLogic and Inventor's VBA specifically, is there any reason not to use the more succinct vbCrLf, or even vbLf or vbCr?

 

Oh, and I'm asking in regards to their use in MessageBoxes, strings, and even output to text files via, for example, System.IO.File.WriteAllText.

3 REPLIES 3
Message 2 of 4
DRoam
in reply to: DRoam

Just answered part of my question with a quick test. While vbCrLf and vbNewLine (and also Environment.NewLine) result in a proper line break when exported to a text file with WriteAllText, vbLf and vbCr do not.

 

So it's down to vbNewLine and vbCrLf.

 

So, any reason not to use vbCrLf over vbNewLine?

Message 3 of 4
JamieVJohnson2
in reply to: DRoam

From:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualbasic.constants.vbcrlf?view=netframework...

 

vbCrLf :  Represents a carriage-return character combined with a linefeed character for print and display functions.

 

Also it states vbNewLine is now obsolete.

 

jvj
Message 4 of 4
DRoam
in reply to: JamieVJohnson2

I didn't even think to check the actual official documentation...

 

That about settles it! Glad it's the one that's faster to type that's still supported 😉

 

Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report