Click here to Skip to main content
16,004,411 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: vb6 to vb.net conversion Help Pin
nishkarsh_k29-Oct-07 14:45
nishkarsh_k29-Oct-07 14:45 
QuestionReportViewer Pin
Abbhie29-Oct-07 6:07
Abbhie29-Oct-07 6:07 
AnswerRe: ReportViewer Pin
pmarfleet29-Oct-07 7:16
pmarfleet29-Oct-07 7:16 
GeneralRe: ReportViewer Pin
Salman Sheikh29-Oct-07 22:26
Salman Sheikh29-Oct-07 22:26 
GeneralRe: ReportViewer Pin
pmarfleet29-Oct-07 23:09
pmarfleet29-Oct-07 23:09 
GeneralRe: ReportViewer Pin
Abbhie30-Oct-07 5:13
Abbhie30-Oct-07 5:13 
GeneralRe: ReportViewer Pin
pmarfleet30-Oct-07 5:42
pmarfleet30-Oct-07 5:42 
GeneralRe: ReportViewer Pin
Abbhie31-Oct-07 20:48
Abbhie31-Oct-07 20:48 
I got a code here for converting numeric value into words..

Public Class Form1<br />
    Inherits System.Windows.Forms.Form<br />
<br />
    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click<br />
        txtResult.Text = NumberToString(CDbl(txtNumber.Text))<br />
    End Sub<br />
<br />
    ' Return a word representation of the whole number value.<br />
    Private Function NumberToString(ByVal num As Double) As String<br />
        ' Remove any fractional part.<br />
        num = Int(num)<br />
<br />
        ' If the number is 0, return zero.<br />
        If num = 0 Then Return "zero"<br />
<br />
        Static groups() As String = {"", "thousand", "million", "billion", "trillion", "quadrillion", "?", "??", "???", "????"}<br />
        Dim result As String = ""<br />
<br />
        ' Process the groups, smallest first.<br />
        Dim quotient As Double<br />
        Dim remainder As Integer<br />
        Dim group_num As Integer = 0<br />
        Do While num > 0<br />
            ' Get the next group of three digits.<br />
            quotient = Int(num / 1000)<br />
            remainder = CInt(num - quotient * 1000)<br />
            num = quotient<br />
<br />
            ' Convert the group into words.<br />
            result = GroupToWords(remainder) & _<br />
                " " & groups(group_num) & ", " & _<br />
                result<br />
<br />
            ' Get ready for the next group.<br />
            group_num += 1<br />
        Loop<br />
<br />
        ' Remove the trailing ", ".<br />
        If result.EndsWith(", ") Then<br />
            result = result.Substring(0, result.Length - 2)<br />
        End If<br />
<br />
        Return result.Trim()<br />
    End Function<br />
<br />
    ' Convert a number between 0 and 999 into words.<br />
    Private Function GroupToWords(ByVal num As Integer) As String<br />
        Static one_to_nineteen() As String = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eightteen", "nineteen"}<br />
        Static multiples_of_ten() As String = {"twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"}<br />
<br />
        ' If the number is 0, return an empty string.<br />
        If num = 0 Then Return ""<br />
<br />
        ' Handle the hundreds digit.<br />
        Dim digit As Integer<br />
        Dim result As String = ""<br />
        If num > 99 Then<br />
            digit = num \ 100<br />
            num = num Mod 100<br />
            result = one_to_nineteen(digit) & " hundred"<br />
        End If<br />
<br />
        ' If num = 0, we have hundreds only.<br />
        If num = 0 Then Return result.Trim()<br />
<br />
        ' See if the rest is less than 20.<br />
        If num < 20 Then<br />
            ' Look up the correct name.<br />
            result &= " " & one_to_nineteen(num)<br />
        Else<br />
            ' Handle the tens digit.<br />
            digit = num \ 10<br />
            num = num Mod 10<br />
            result &= " " & multiples_of_ten(digit - 2)<br />
<br />
            ' Handle the final digit.<br />
            If num > 0 Then<br />
                result &= " " & one_to_nineteen(num)<br />
            End If<br />
        End If<br />
<br />
        Return result.Trim()<br />
    End Function<br />
<br />
End Class<br />



---the code works but not on with decimals.. and i hope i can also put currencies such as dollars and cents..
I had a hard time on the logic here..
QuestionWeb service reference problem in Window Service Pin
sabby200629-Oct-07 3:13
sabby200629-Oct-07 3:13 
AnswerRe: Web service reference problem in Window Service Pin
Dave Kreskowiak30-Oct-07 4:58
mveDave Kreskowiak30-Oct-07 4:58 
QuestionPackaging and Deployment Pin
briogene29-Oct-07 2:41
briogene29-Oct-07 2:41 
AnswerRe: Packaging and Deployment Pin
Dave Kreskowiak29-Oct-07 4:54
mveDave Kreskowiak29-Oct-07 4:54 
AnswerRe: Packaging and Deployment Pin
nishkarsh_k29-Oct-07 14:48
nishkarsh_k29-Oct-07 14:48 
QuestionHOW TO SEND SMS Pin
kkb_200129-Oct-07 1:39
kkb_200129-Oct-07 1:39 
AnswerRe: HOW TO SEND SMS Pin
Dave Kreskowiak29-Oct-07 4:51
mveDave Kreskowiak29-Oct-07 4:51 
AnswerRe: HOW TO SEND SMS Pin
AliAmjad29-Oct-07 4:59
AliAmjad29-Oct-07 4:59 
QuestionHow to connect USB Port in VB/VB .NET Pin
kkb_200129-Oct-07 1:38
kkb_200129-Oct-07 1:38 
AnswerRe: How to connect USB Port in VB/VB .NET Pin
Dave Kreskowiak29-Oct-07 4:48
mveDave Kreskowiak29-Oct-07 4:48 
QuestionSaving image with customize size Pin
yogesh_kumar_agarwal29-Oct-07 1:04
yogesh_kumar_agarwal29-Oct-07 1:04 
AnswerRe: Saving image with customize size Pin
Abhijit Jana29-Oct-07 4:16
professionalAbhijit Jana29-Oct-07 4:16 
QuestionBug?? mdichildactivate Pin
Tom Deketelaere28-Oct-07 23:42
professionalTom Deketelaere28-Oct-07 23:42 
AnswerRe: Bug?? mdichildactivate Pin
Dave Kreskowiak29-Oct-07 4:46
mveDave Kreskowiak29-Oct-07 4:46 
GeneralRe: Bug?? mdichildactivate Pin
Tom Deketelaere29-Oct-07 5:16
professionalTom Deketelaere29-Oct-07 5:16 
GeneralRe: Bug?? mdichildactivate Pin
Dave Kreskowiak29-Oct-07 7:09
mveDave Kreskowiak29-Oct-07 7:09 
GeneralRe: Bug?? mdichildactivate Pin
Tom Deketelaere29-Oct-07 7:30
professionalTom Deketelaere29-Oct-07 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.