am working in vb.net platform.I want to convert input value integer to word during at runtime

Recommended Answers

All 14 Replies

Hi,

I'am not clear what u r asking for..?
Did u mean to use "CStr()" Function..?

Regards
Veena

convert an integer into words?? ASCII into char ??
if your integer is an ascii value you can use:

dim a as integer
dim b as string

a = 65

b = chr (a)

then the b value is "A"

If you are looking for the dos word I believe in Net it is Int32.

Do you want to find the ASCII equivalent of that interger value or simply want to convert to string?

If You wanna convert it to string use Cstr("Your Integer")

and then ur integer will be string

example :

Int = 12345

'You wanna convert it to string

just use

cStr(int)

then the format of your int will be string.

actually I understand your query.
it's actually my working assign in school convert 1-100 into words. although i have yet to get my assignment done, i have only managed to work on until nineteen.
supposedly there's a code repeating twenty, thirty something and so on.

private sub cmd1_()
dim temp as integero
dim no as integer

no=text1.text

if no<20 then

Select Case no
Case 1
total = "one"
Case 2
total = "two"
Case 3
total = "three"
and so on until nineteen...
End Select
End If


If no >= 20 And Not (no >= 30) Then
mo = no Mod 20

Until here only.. I am still confused how to get the numbers working for the twenty up where i am supposed to make
total="twenty"+ no in words

supposedly the text2.text =total

if anyone has ideas, will be glad to have your help

jenny

hey i got it already.
see below
jenny

Private Sub Command1_Click()
Dim temp As Integer
Dim ans As Integer
Dim second As String

no = t1.Text

If no < 20 Then

Select Case no
Case 1
total = "One"
Case 2
total = "Two"
Case 3
total = "Three"
Case 4
total = "Four"
Case 5
total = "Five"
Case 6
total = "Six"
Case 7
total = "Seven"
Case 8
total = "Eight"
Case 9
total = "Nine"
Case 10
total = "Ten"
Case 11
total = "Eleven"
Case 12
total = "Twelve"
Case 13
total = "Thirteen"
Case 14
total = "Fourteen"
Case 15
total = "Fifteen"
Case 16
total = "Sixteen"
Case 17
total = "Seventeen"
Case 18
total = "Eighteen"
Case 19
total = "Nineteen"
End Select
End If


If no >= 20 And Not (no >= 30) Then
mo = no Mod 20
total = "Twenty"
End If

If no >= 30 And Not (no >= 40) Then
mo = no Mod 30
total = "Thirty"
End If

If no >= 40 And Not (no >= 50) Then
mo = no Mod 40
total = "Forty"
End If

If no >= 50 And Not (no >= 60) Then
mo = no Mod 50
total = "Fifty"
End If

If no >= 60 And Not (no >= 70) Then
mo = no Mod 60
total = "Sixty"
End If

If no >= 70 And Not (no >= 80) Then
mo = no Mod 70
total = "Seventy"
End If

If no >= 80 And Not (no >= 90) Then
mo = no Mod 80
total = "Eighty"
End If

If no >= 90 And Not (no >= 100) Then
mo = no Mod 90
total = "Ninety"
End If

If no = 100 Then
total = "One Hundred"
End If

Select Case mo
Case 1
total = total + " " + "one"
Case 2
total = total + " " + "two"
Case 3
total = total + " " + "three"
Case 4
total = total + " " + "four"
Case 5
total = total + " " + "five"
Case 6
total = total + " " + "six"
Case 7
total = total + " " + "seven"
Case 8
total = total + " " + "eight"
Case 9
total = total + " " + "nine"
End Select

total = total

t2.Text = total

End Sub

oops i forgot, disregard the dims
they're supposed to be
dim no as integer
dim mo as integer
dim total as string

congratulations, if it's finished then mark it as solved for the next person who looks. :)

And... Let's not post to threads that are years old.

crap I missed that one - oh how I wish that these things could be closed after time . ..

congratulations, if it's finished then mark it as solved for the next person who looks. :)

how do i mark it as solved? sorry, im kinda new in this.

thanks.
jenny

hi comatose,

im sorry i did kind of reply to old posting. its coz i was actually looking for the answer and found those threads. when i managed to solve it, i posted back in case others like me are looking for answers. anyway, its noted.

commented: Good Followup. +9

this function change onliy up to 100 no more then 100

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.