Imports System.IO
Public Class Form1
Dim Filename As String
Dim SW As StreamWriter
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
With SaveFileDialog1
Filename = (Application.StartupPath & "\test")
SW = New StreamWriter(Filename)
Dim luk1 As Integer
Dim luk10 As Integer
Dim luk100 As Integer
Dim luk1K As Integer
Dim luk10K As Integer
Dim luk100K As Integer
Dim luk1M As Integer
Dim luk10M As Integer
Dim luk100M As Integer
Dim sum As Integer
luk1 = CDbl(TextBox1.Text) Mod 10
luk10 = (CDbl(TextBox1.Text) Mod 100) \ 10
luk100 = (CDbl(TextBox1.Text) Mod 1000) \ 100
luk1K = (CDbl(TextBox1.Text) Mod 10000) \ 1000
luk10K = (CDbl(TextBox1.Text) Mod 100000) \ 10000
luk100K = (CDbl(TextBox1.Text) Mod 1000000) \ 100000
luk1M = (CDbl(TextBox1.Text) Mod 10000000) \ 1000000
luk10M = (CDbl(TextBox1.Text) Mod 100000000) \ 10000000
luk100M = (CDbl(TextBox1.Text) Mod 1000000000) \ 100000000
'-------------------------------------------------หลักร้อยล้าน----------------------------------------
If luk100M > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk100M & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\100.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
If luk1M = 0 And luk10M = 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
End If
If luk10M > 2 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk10M & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\10.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
If luk1M = 1 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\ed.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
If luk1M = 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
ElseIf luk10M = 2 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\20.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
If luk1M = 1 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\ed.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
If luk1M = 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
ElseIf luk10M = 1 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\10.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
If luk1M = 1 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\ed.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
If luk1M = 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
End If
'-----------------------------------------หลักล้าน------------------------------------------------
If luk1M > 1 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk1M & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
ElseIf luk1M = 1 And luk10M = 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk1M & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1m.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
'------------------------------------------หลักแสน-----------------------------------------------
If luk100K > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk100K & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\100K.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
'------------------------------------------หลักหมื่น-----------------------------------------------
If luk10K > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk10K & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\10K.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
'------------------------------------------หลักพัน-----------------------------------------------
If luk1K > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk1K & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\1K.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
'------------------------------------------หลักร้อย-----------------------------------------------
If luk100 > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk100 & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\100.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
'------------------------------------------หลักสิบ-----------------------------------------------
If luk10 > 2 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk10 & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\10.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
ElseIf luk10 = 1 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\10.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
ElseIf luk10 = 2 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\20.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
'------------------------------------------หลักหน่วย-----------------------------------------------
If luk1 = 1 And sum > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\ed.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
ElseIf luk1 > 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\" & luk1 & ".wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
ElseIf luk1 = 0 And sum = 0 Then
SW.Write("Read from file... " & Application.StartupPath & "\voice\Man\0.wav" & (ControlChars.NewLine))
SW.Write("Play" & (ControlChars.NewLine))
End If
SW.Flush()
SW.Close()
End With
Shell("command.bat")
End Sub
'------------------------------------------------------ Add "," ----------------------------------------------------------------------------------------------------
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim number As Integer
Dim str As String
'------------------------------ input frist = 0 ------------------------------
If TextBox1.Text = "0" Then
TextBox1.Text = "0"
Return
ElseIf TextBox1.Text = "00" Then
TextBox1.Text = "0"
TextBox1.Select(TextBox1.Text.Length, 1)
Return
'---------------------------- remove all input --------------------------
ElseIf TextBox1.Text = "" Then
TextBox1.Text = ""
Return
End If
'------------------------------- add "," in number -------------------------
number = CInt(TextBox1.Text)
str = number.ToString("#,#")
TextBox1.Text = str
TextBox1.Select(TextBox1.Text.Length, 1)
End Sub
Private Sub AboutUsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutUsToolStripMenuItem.Click
AboutBox1.ShowDialog()
End Sub
End Class