Do you receive the Programmer's Heaven newsletter? If not, why not subscribe?

View \DigitToChar.frm

digit_to_char 1.0

Submitted By: a_jay
Rating: (Not rated) (Rate It)


VERSION 5.00
Begin VB.Form Form1
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Conversion"
   ClientHeight    =   2280
   ClientLeft      =   3630
   ClientTop       =   2475
   ClientWidth     =   4095
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2280
   ScaleWidth      =   4095
   ShowInTaskbar   =   0   'False
   Begin VB.TextBox Text3
      BeginProperty Font
         Name            =   "DevLys 010"
         Size            =   11.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   795
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      TabIndex        =   3
      Top             =   1380
      Width           =   3855
   End
   Begin VB.TextBox Text2
      BeginProperty Font
         Name            =   "Arial"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   795
      Left            =   120
      Locked          =   -1  'True
      MultiLine       =   -1  'True
      TabIndex        =   1
      Top             =   420
      Width           =   3855
   End
   Begin VB.TextBox Text1
      Alignment       =   2  'Center
      Height          =   330
      Left            =   2145
      MaxLength       =   9
      TabIndex        =   0
      Top             =   30
      Width           =   1785
   End
   Begin VB.Label Label1
      Caption         =   "Enter Digit To Convert"
      BeginProperty Font
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   225
      Left            =   105
      TabIndex        =   2
      Top             =   75
      Width           =   1995
   End
   Begin VB.Menu about
      Caption         =   "&About"
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim oned(20) As String
Dim ty(9) As String
Dim one_hundred(100) As String
'-------Functions to convert in Hindi-------------
Function H_Hundred(t1 As String) As String
If t1 = "" Then
    Text3 = ""
ElseIf Len(t1) < 3 Then
    Text3 = one_hundred(Val(t1))
ElseIf Len(t1) = 3 Then
    Text3 = one_hundred(Left(t1, 1)) & " lkS " & one_hundred(Right(t1, 2))
End If
If Left(Trim(Text3), 3) = "lkS" Then
    Text3 = Replace(Text3, "lkS", "")
End If
H_Hundred = Trim(Text3)
End Function
Function H_Thousand(t1 As String) As String
If Len(t1) = 4 Then
    Text3 = one_hundred(Left(t1, 1)) & " gtkj " & H_Hundred(Mid(t1, 2))
ElseIf Len(t1) = 5 Then
    Text3 = one_hundred(Left(t1, 2)) & " gtkj " & H_Hundred(Mid(t1, 3))
End If
If Left(Trim(Text3), 4) = "gtkj" Then
    Text3 = Replace(Text3, "gtkj", "")
End If
H_Thousand = Trim(Text3)
End Function
Function H_Lack(t1 As String) As String
If Len(t1) = 6 Then
    Text3 = one_hundred(Left(t1, 1)) & " yk[k " & H_Thousand(Mid(t1, 2))
ElseIf Len(t1) = 7 Then
    Text3 = one_hundred(Left(t1, 2)) & " yk[k " & H_Thousand(Mid(t1, 3))
End If
If Left(Trim(Text3), 4) = "yk[k" Then
    Text3 = Replace(Text3, "yk[k", "")
End If
H_Lack = Trim(Text3)
End Function
Function H_Carore(t1 As String)
If Len(t1) = 8 Then
    Text3 = one_hundred(Left(t1, 1)) & " djksM " & H_Lack(Mid(t1, 2))
ElseIf Len(t1) = 9 Then
    Text3 = one_hundred(Left(t1, 2)) & " djksM " & H_Lack(Mid(t1, 3))
End If
If Left(Trim(Text3), 5) = "djksM" Then
    Text3 = Replace(Text3, "djksM", "")
End If
H_Carore = Trim(Text3)
End Function
'-------Function to convert in English-------------
Function Hundred(t1 As String) As String
If t1 = "" Then
    Text2 = ""
ElseIf t1 < 20 Then
    Text2.Text = oned(t1)
ElseIf t1 >= 20 And t1 < 100 Then
    Text2.Text = ty(Left(t1, 1)) & oned(Right(t1, 1))
ElseIf Len(t1) = 3 And Right(t1, 2) < 20 Then
    Text2 = oned(Left(t1, 1)) & " Hundred " & oned(Right(t1, 2))
ElseIf Len(t1) = 3 And Right(Val(t1), 2) >= 20 Then
    Text2 = oned(Left(t1, 1)) & " Hundred " & ty(Mid(t1, 2, 1)) & oned(Right(t1, 1))
End If
If Trim(Text2) = "Hundred" Then
    Text2 = ""
End If
Hundred = Trim(Text2)
End Function
Function Thousand(t1 As String) As String
If Len(t1) = 4 Then
    Text2 = oned(Left(t1, 1)) & " Thousand " & Hundred(Mid(t1, 2))
ElseIf Len(t1) = 5 And Left(Val(t1), 2) < 20 Then
    Text2 = oned(Left(t1, 2)) & " Thousand " & Hundred(Mid(t1, 3))
ElseIf Len(t1) = 5 And Left(Val(t1), 2) >= 20 Then
    Text2 = ty(Mid(t1, 1, 1)) & oned(Mid(t1, 2, 1)) & " Thousand " & Hundred(Mid(t1, 3))
End If
If Left(Trim(Text2), 8) = "Thousand" Then
    Text2 = Replace(Text2, "Thousand", "")
End If
Thousand = Trim(Text2)
End Function
Function Lack(t1 As String) As String
If Len(t1) = 6 Then
    Text2 = oned(Left(t1, 1)) & " Lack " & Thousand(Mid(t1, 2))
ElseIf Len(t1) = 7 And Left(Val(t1), 2) < 20 Then
    Text2 = oned(Left(t1, 2)) & " Lack " & Thousand(Mid(t1, 3))
ElseIf Len(t1) = 7 And Left(Val(t1), 2) >= 20 Then
    Text2 = ty(Mid(t1, 1, 1)) & oned(Mid(t1, 2, 1)) & " Lack " & Thousand(Mid(t1, 3))
End If
If Left(Trim(Text2), 4) = "Lack" Then
    Text2 = Replace(Text2, "Lack", "")
End If
Lack = Trim(Text2)
End Function
Function Carore(t1 As String)
If Len(t1) = 8 Then
    Text2 = oned(Left(t1, 1)) & " Carore " & Lack(Mid(t1, 2))
ElseIf Len(t1) = 9 And Left(Val(t1), 2) < 20 Then
    Text2 = oned(Left(t1, 2)) & " Carore " & Lack(Mid(t1, 3))
ElseIf Len(t1) = 9 And Left(Val(t1), 2) >= 20 Then
    Text2 = ty(Mid(t1, 1, 1)) & oned(Mid(t1, 2, 1)) & " Carore " & Lack(Mid(t1, 3))
End If
If Left(Trim(Text2), 6) = "Carore" Then
    Text2 = Replace(Text2, "Carore", "")
End If
Carore = Trim(Text2)
End Function

Private Sub about_Click()
Form1.Hide
Form2.Show
End Sub

Private Sub Form_Load()
'----------Declaration for English Conversion------------
oned(0) = "": oned(1) = "One": oned(2) = "Two": oned(3) = "Three"
oned(4) = "Four": oned(5) = "Five": oned(6) = "Six": oned(7) = "Seven"
oned(8) = "Eight": oned(9) = "Nine": oned(10) = "Ten": oned(11) = "Eleven"
oned(12) = "Twelve": oned(13) = "Thirteen": oned(14) = "Fourteen"
oned(15) = "Fifteen": oned(16) = "Sixteen": oned(17) = "Seventeen"
oned(18) = "Eighteen": oned(19) = "Nineteen"
ty(0) = "": ty(2) = "Twenty": ty(3) = "Thirty": ty(4) = "Fourty"
ty(5) = "Fifty": ty(6) = "Sixty": ty(7) = "Sevnety":
ty(8) = "Eighty": ty(9) = "Ninety"
'----------Declaration for Hindi Conversion------------
one_hundred(1) = ",d": one_hundred(2) = "nks": one_hundred(3) = "rhu"
one_hundred(4) = "pkj": one_hundred(5) = "ikWp": one_hundred(6) = "N%"
one_hundred(7) = "lkr": one_hundred(8) = "vkB": one_hundred(9) = "ukS"
one_hundred(10) = "nl": one_hundred(11) = "X;kjg": one_hundred(12) = "ckjg"
one_hundred(13) = "rsjg": one_hundred(14) = "pkSng": one_hundred(15) = "ianzg"
one_hundred(16) = "lksyg": one_hundred(17) = "l = g": one_hundred(18) = "vBkjg"
one_hundred(19) = "mUuhl": one_hundred(20) = "chl": one_hundred(21) = "bDdhl"
one_hundred(22) = "ckbl": one_hundred(23) = "rsbl": one_hundred(24) = "pkSbl"
one_hundred(25) = "iPphl": one_hundred(26) = "NCchl": one_hundred(27) = "lRrkbl"
one_hundred(28) = "vBkbl": one_hundred(29) = "mUrhl": one_hundred(30) = "rhl"
one_hundred(31) = "bdrhl": one_hundred(32) = "cRrhl": one_hundred(33) = "rSrhl"
one_hundred(34) = "pkSrhl": one_hundred(35) = "iSrhl": one_hundred(36) = "NRrhl"
one_hundred(37) = "lSrhl": one_hundred(38) = "vMrhl": one_hundred(39) = "mupkyhl"
one_hundred(40) = "pkyhl": one_hundred(41) = "bdrkyhl": one_hundred(42) = "c;kyhl"
one_hundred(43) = "rhj;kyhl": one_hundred(44) = "pokyhl": one_hundred(45) = "iSarkyhl"
one_hundred(46) = "N;kyhl": one_hundred(47) = "lSrkyhl": one_hundred(48) = "vMrkyhl"
one_hundred(49) = "muipkl": one_hundred(50) = "ipkl": one_hundred(51) = "bdkou":
one_hundred(52) = "ckou": one_hundred(53) = "rhjiu": one_hundred(54) = "pkSiu":
one_hundred(55) = "ipiu": one_hundred(56) = "NIiu": one_hundred(57) = "lRrkou":
one_hundred(58) = "vBkou": one_hundred(59) = "mulkgB": one_hundred(60) = "lkgB":
one_hundred(61) = "bdlB": one_hundred(62) = "cklB": one_hundred(63) = "rhjlB":
one_hundred(64) = "pkSlB": one_hundred(65) = "iSlB": one_hundred(66) = "NkNB":
one_hundred(67) = "mulB": one_hundred(68) = "vMlB": one_hundred(69) = "mulRrj":
one_hundred(70) = "lRrj": one_hundred(71) = "bdgRrj": one_hundred(72) = "cgRrj":
one_hundred(73) = "rhgRrj": one_hundred(74) = "pkSgRrj": one_hundred(75) = "ipgRrj":
one_hundred(76) = "NgRrj": one_hundred(77) = "flR;ksRrj": one_hundred(78) = "vBgRrj":
one_hundred(79) = "muvLlh": one_hundred(80) = "vLlh": one_hundred(81) = "bDd;klh":
one_hundred(82) = "c;klh": one_hundred(83) = "frj;klh": one_hundred(84) = "pkSjklh":
one_hundred(85) = "fip;klh": one_hundred(86) = "fN;klh": one_hundred(87) = "flR;klh":
one_hundred(88) = "vB;klh": one_hundred(89) = "mu;klh": one_hundred(90) = "uCcs":
one_hundred(91) = "budkuos": one_hundred(92) = "c;kuos": one_hundred(93) = "frjukos":
one_hundred(94) = "pkSjkuos": one_hundred(95) = "fiupkuos": one_hundred(96) = "N;kuos":
one_hundred(97) = "flRrkuos": one_hundred(98) = "vBkuos": one_hundred(99) = "fuUukuos":
one_hundred(100) = "lkS":
End Sub

Private Sub Text1_Change()
If Len(Text1) > 7 Then
    Carore (Text1)
    H_Carore (Text1)
ElseIf Len(Text1) > 5 Then
    Lack (Text1)
    H_Lack (Text1)
ElseIf Len(Text1) > 3 Then
    Thousand (Text1)
    H_Thousand (Text1)
Else
    Hundred (Text1)
    H_Hundred (Text1)
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then Exit Sub
If KeyAscii < 48 Or KeyAscii > 57 Then
    KeyAscii = 0
End If
End Sub
 
corner
© 1996-2008. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin.
bootstrapLabs Logo A bootstrapLabs project.