Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

if user enters 1 or 2 or any other number in digit format in
next textbox it should show the answer in word reading
like if enters 12 answer should be twelve

Answer Posted / cherran

Here is a Program, which can perform upto 99,999 ...
Note: in a vb.net form you have to place one text box named
as txt1 and one label named as Lab1....
Private Sub txt1_TextChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles txt1.TextChanged
Try
If Val(txt1.Text) <> 0 Then
fun(txt1.Text)
Else
Lab1.Text = ""
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Public Function fun(ByVal t As Integer)
Dim l As Int16
l = Len(CStr(t))
Select Case l
Case 1
Lab1.Text = Ones(t)
Case 2
Lab1.Text = Case2(t)
Case 3
Lab1.Text = Case3(t)
Case 4
Lab1.Text = Case4(t)
Case 5
Lab1.Text = Case5(t)
End Select
fun = Lab1.Text
End Function
Public Function Case5(ByVal t As Integer) As String
Dim L2 As String
Dim R3 As String
L2 = Strings.Left(CStr(t), 2)
R3 = Strings.Right(CStr(t), 3)
If CInt(R3) = 0 Then
Case5 = Case2(CInt(L2)) & " Thousand "
Else
Case5 = Case2(CInt(L2)) & " Thousand "
If Strings.Left(R3, 1) = "0" Then
Case5 = Case5 & " and " & Case2(CInt(R3))
Else
Case5 = Case5 & Case3(CInt(R3))
End If
End If
End Function
Public Function Case2(ByVal t As Integer) As String
Dim q, r As Int16
If t > 10 And t < 20 Then
Case2 = Teens(t)
Else
q = Int(t / 10)
r = t Mod 10
Case2 = Tens(q) & " " & Ones(r)
End If
End Function
Public Function Case3(ByVal t As Integer) As String
Dim q1, q2, q, r As Integer
Dim LabTxt As String
q1 = Int(t / 100)
If (t - (q1 * 100)) = 0 Then
LabTxt = Ones(q1) & " Hundred "
Else
LabTxt = Ones(q1) & " Hundred and "
End If
q2 = t - (q1 * 100)
If q2 > 10 And q2 < 20 Then
Case3 = LabTxt & Teens(q2)
Else
q = Int(q2 / 10)
r = q2 Mod 10
Case3 = LabTxt & Tens(q) & " " & Ones(r)
End If
End Function

Public Function Case4(ByVal t As Integer) As String
Dim q As Int16
Dim r As Int16
Dim q1 As Int16
Dim q2 As Int16
Dim LabTxt As String
Dim q4 As Integer
q4 = Int(t / 1000)
LabTxt = Ones(q4) & " Thousand "
t = t - q4 * 1000
If t = 0 Then
Case4 = LabTxt
Exit Function
End If
q1 = Int(t / 100)
If q1 = 0 Then
LabTxt = LabTxt & " and "
If t > 10 And t < 20 Then
Case4 = LabTxt & Teens(t)
Else
q = Int(t / 10)
r = t Mod 10
Case4 = LabTxt & Tens(q) & " " & Ones(r)
End If
Exit Function
End If
If (t - (q1 * 100)) = 0 Then
LabTxt = LabTxt & Ones(q1) & " Hundred "
Else
LabTxt = LabTxt & Ones(q1) & " Hundred and "
End If
q2 = t - (q1 * 100)
If q2 > 10 And q2 < 20 Then
Case4 = LabTxt & Teens(q2)
Else
q = Int(q2 / 10)
r = q2 Mod 10
Case4 = LabTxt & Tens(q) & " " & Ones(r)
End If
End Function
Public Function Ones(ByVal t As Integer) As String
Ones = ""
Select Case t
Case 1
Return "One"
Case 2
Return "Two"
Case 3
Return "Three"
Case 4
Return "Four"
Case 5
Return "Five"
Case 6
Return "Six"
Case 7
Return "Seven"
Case 8
Return "Eight"
Case 9
Return "Nine"
End Select
End Function
Public Function Tens(ByVal Que As Int16) As String
Select Case Que
Case 1
Return "Ten"
Case 2
Return "Twenty"
Case 3
Return "Thirty"
Case 4
Return "Forty"
Case 5
Return "Fifty"
Case 6
Return "Sixty"
Case 7
Return "Seventy"
Case 8
Return "Eighty"
Case 9
Return "Ninty"
End Select
End Function

Public Function Teens(ByVal Que As Int16) As String
Select Case Que
Case 11
Return "Eleven"
Case 12
Return "Twelve"
Case 13
Return "Thirteen"
Case 14
Return "Forteen"
Case 15
Return "Fifteen"
Case 16
Return "Sixteen"
Case 17
Return "Seventeen"
Case 18
Return "Eighteen"
Case 19
Return "Ninteen"
End Select
End Function

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Sir, what code to store data from vb net sql server 2008 to 2005 and at the same time in order to validate the data entered is not the same, but there have been contacts in the module. Examples such as the log table that I created, the user name as the primary key.

2131


What is different between web.config and machine.config and where it will be ?

959


Which is the tool which can convert visual basic old version to .net compatibility version?

898


Explain the difference between .dll extension and .exe extension files?

991


What does assert() method do In VB.NET

930


Explain the difference between web.config and machine.config and where it will be ?

866


Define naming convention?

967


What do you mean by option strict on?

1070


hello thank you for replying to my question regarding adding barcode fonts in vb.net project. I have downloaded a free font and added in my vb.net project but now i dont know how to use that i need to generate barcodes can any body help me how to use those fonts these are font3of9 .i need a small code to use these fonts to generate barcode thank u!

1967


Using VB, how can you change the Mouse Pointer?

1053


What is a stream in vb.net?

923


What is the use of system.diagnostics.process class?

990


how to get dynamic control array position or its index position?

2464


what is the need for dynamic controls in vb.net? i would like to know for what purpose should we create the controls dynamically? please give the answer in simple words.

2341


So you know which dll is used for microsoft .net run time?

916