text coding help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasadsv
    New Member
    • Mar 2007
    • 4

    #1

    text coding help

    I used this type script for conversion of text to other language text and little modified
    but this this used originally for numeric to word
    how to modify for text conversion
    Private Sub txtamount_Chang e()
    Dim s, c, l, th, h, t, d As String
    c = ""
    l = ""
    th = ""
    h = ""
    t = ""
    d = ""
    s = Str(Int(Val(txt amount.Text)))
    d = (Str(Val(txtamo unt.Text) - Val(s)))
    d = Str(Int(Val(d) * 100))
    If Len(s) > 7 Then
    If Len(s) = 9 Then
    If Val(Left(s, 2)) = 0 Then
    c = ""
    Else
    c = charcters(Val(L eft(s, 2)))
    c = c & " Crores "
    End If
    s = Right(s, 7)
    ElseIf Len(s) = 8 Then
    If Val(Left(s, 1)) = 0 Then
    c = ""
    Else
    c = charcters(Val(L eft(s, 1)))
    c = c & " Crores "
    End If
    s = Right(s, 7)
    End If
    End If
    If Len(s) > 5 Then
    If Len(s) = 7 Then
    If Val(Left(s, 2)) = 0 Then
    l = ""
    Else
    l = charcters(Val(L eft(s, 2)))
    l = l & " Lakhs "
    End If
    s = Right(s, 5)
    ElseIf Len(s) = 6 Then
    If Val(Left(s, 1)) = 0 Then
    l = ""
    Else
    l = charcters(Val(L eft(s, 1)))
    l = l & " Lakhs "
    End If
    s = Right(s, 5)
    End If
    End If
    If Len(s) > 3 Then
    If Len(s) = 5 Then
    If Val(Left(s, 2)) = 0 Then
    th = ""
    Else
    th = charcters(Val(L eft(s, 2)))
    th = th & " Thousand "
    End If
    s = Right(s, 3)
    ElseIf Len(s) = 4 Then
    If Val(Left(s, 1)) = 0 Then
    th = ""
    Else
    th = charcters(Val(L eft(s, 1)))
    th = th & " Thousand "
    End If
    s = Right(s, 3)
    End If
    End If
    If Len(s) > 2 Then
    If Val(Left(s, 1)) = 0 Then
    h = ""
    Else
    h = charcters(Val(L eft(s, 1)))
    h = h & " Hundred "
    End If
    s = Right(s, 2)
    End If
    If Len(s) > 0 Then
    t = t & charcters(Val(s ))
    't = t & " Rs."
    End If

    If Val(d) = 0 Then
    s = c & l & th & h & t & " Rs."
    Else
    d = charcters(Val(d ))
    s = c & l & th & h & t & " Rs. " & d & " Paise"
    End If
    txtinwords.Text = s
    End Sub




    Public Function charcters(Strch r As string) As String
    If Strchr = a Then
    charcters = "µ"
    ElseIf Strchr = b Then
    charcters = "Ž"
    ElseIf Strchr = c Then
    charcters = "û"
    ElseIf Strchr = d Then
    charcters = "õ"
    ElseIf Strchr = e Then
    charcters = "ý-"

    End If
    End Function
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    This question is being moved to the Visual Basic forum.

    Technical questions are not allowed in the cafe.

    ADMIN

    Comment

    Working...