| Description:I recently saw a submission on how to do new lines in a text box and it reminded me of these two functions I created when I had a program I wrote which required me to format a large report. I got tired of writing this vbtab & vbtab & vbtab kind of thing because in a Text box Tab(3) does not work. Same with line feeds. VbCrLf & VbCrLf gets tiring too. This function handles it all for you. :) Inputs:Simply call the function TxtTab(How Many Tabs You Want) and TxtCrLf(How Many Line Feeds you want) Returns:Returns the number of Tabs and Carriage Returns/Line Feeds you request Side Effects:I have only created for a maximum of 5, although you can add on an make it more I have set it that if you request more then 5, it sets it to 5 and if you request less then 0, it sets it to 0 Place this code in a Module to make them avalible to your entire program Public Function TxtTab(HowMany As Integer) As String 'Makes sure you do not request more or less then this fuction can handle If HowMany > 5 Then HowMany = 5 If HowMany < 0 Then HowMany = 0 'Function for tab spacing in a Text Box or RT Box Select Case HowMany Case 0 TxtTab = "" Case 1 TxtTab = vbTab Case 2 TxtTab = vbTab & vbTab Case 3 TxtTab = vbTab & vbTab & vbTab Case 4 TxtTab = vbTab & vbTab & vbTab & vbTab Case 5 TxtTab = vbTab & vbTab & vbTab & vbTab & vbTab Case Else End Select End Function Public Function TxtCrLf(HowMany As Integer) As String If HowMany > 5 Then HowMany = 5 If HowMany < 0 Then HowMany = 0 'Function of Carriage Returns and Line Feeds for Text Box or RT Box Select Case HowMany Case 0 TxtCrLf = "" Case 1 TxtCrLf = vbCrLf Case 2 TxtCrLf = vbCrLf & vbCrLf Case 3 TxtCrLf = vbCrLf & vbCrLf & vbCrLf Case 4 TxtCrLf = vbCrLf & vbCrLf & vbCrLf & vbCrLf Case Else End Select End Function |
Tabs and LineFeeds for Text Boxes |
Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design