VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get Balance Of String : Useful Function

by Buddhika Fernando (9 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 16th March 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get Balance Of String : Useful Function

API Declarations


Rem Developed By Buddhika Fernando
Rem Comments [email protected]
Rem Sri Lanka - Vanik Information Technologies (Pvt) Ltd. Programmer

Rate Get Balance Of String : Useful Function



                             ByVal PassTextLen As Integer, _
                             ByVal StatValue As Integer, _
                             ByVal FillString As String, Optional SetToLeft As Boolean = False) As String
      
    Dim Balance      As Integer
    
    If PassText = "" Then Exit Function
    If PassTextLen = 0 Then Exit Function
    If StatValue = 0 Then Exit Function
    If FillString = "" Then Exit Function
    
    Balance = StatValue - PassTextLen
    If Balance <= 0 Then
        GetBalance = PassText
    Else
        If SetToLeft = False Then
            GetBalance = String(Balance, FillString) & PassText
        Else
            GetBalance = PassText & String(Balance, FillString)
        End If
    End If
    
End Function

Private Sub Form_Load()

    Me.Caption = GetBalance("Buddhika Fernando", Len("Buddhika Fernando"), 30, "#", True)
    
End Sub


Download this snippet    Add to My Saved Code

Get Balance Of String : Useful Function Comments

No comments have been posted about Get Balance Of String : Useful Function. Why not be the first to post a comment about Get Balance Of String : Useful Function.

Post your comment

Subject:
Message:
0/1000 characters