Easy CR/LF Padding

Easy CR/LF Padding

When I write text in message boxes, labels, and so on, and I need to include a carriage return/line feed, I use this function, passing it the number of CR/LFs I need. This saves a lot of typing and looking up of ASCII values:

 Sub cmdDelete_Click()	msg = "Are you sure you want " & _		"to delete this item?" & NL(2) & "Press OK"	rc = MsgBox(msg, 4 + 32 + 256, "Confirm Delete")	...end subFunction NL(num_lines As Integer) As String'***************************************'	This function returns a New Line '	character for the number of times '	passed to the function.'***************************************	Dim msg As String	Dim i As Integer	For i = 1 To num_lines		msg = msg & Chr(13) & Chr(10)	Next	NL = msgEnd Function
See also  How to Avoid Money Transfer Scams  

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist