Public Function Terbilang(ByVal nilai As Long) As String
Dim bilangan As String() = {"", "satu", "dua", "tiga", "empat", "lima", _
"enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas"}
If nilai < 12 Then
Return " " & bilangan(nilai)
ElseIf nilai < 20 Then
Return Terbilang(nilai - 10) & " belas"
ElseIf nilai < 100 Then
Return (Terbilang(CInt((nilai \ 10))) & " puluh") + Terbilang(nilai Mod 10)
ElseIf nilai < 200 Then
Return " seratus" & Terbilang(nilai - 100)
ElseIf nilai < 1000 Then
Return (Terbilang(CInt((nilai \ 100))) & " ratus") + Terbilang(nilai Mod 100)
ElseIf nilai < 2000 Then
Return " seribu" & Terbilang(nilai - 1000)
ElseIf nilai < 1000000 Then
Return (Terbilang(CInt((nilai \ 1000))) & " ribu") + Terbilang(nilai Mod 1000)
ElseIf nilai < 1000000000 Then
Return (Terbilang(CInt((nilai \ 1000000))) & " juta") + Terbilang(nilai Mod 1000000)
ElseIf nilai < 1000000000000 Then
Return (Terbilang(CInt((nilai \ 1000000000))) & " milyar") + Terbilang(nilai Mod 1000000000)
ElseIf nilai < 1000000000000000 Then
Return (Terbilang(CInt((nilai \ 1000000000000))) & " trilyun") + Terbilang(nilai Mod 1000000000000)
Else
Return ""
End If
End Function
Private Function GetFirstDayOfMonth(ByVal dtDate As DateTime) As DateTime
Dim dtFrom As DateTime = dtDate
dtFrom = dtFrom.AddDays(-(dtFrom.Day - 1))
Return dtFrom
End Function
Private Function GetLastDayOfMonth(ByVal dtDate As DateTime) As DateTime
Dim dtTo As New DateTime(dtDate.Year, dtDate.Month, 1)
dtTo = dtTo.AddMonths(1)
dtTo = dtTo.AddDays(-(dtTo.Day))
Return dtTo
End Function
'if you put code like:
GetFirstDayOfMonth("2010-05-05") ' It will return = 2010-05-01
GetLastDayOfMonth("2010-05-05") ' It will return = 2010-05-31
Send Email with multiple attachments from VB.NET
JUN 3RD
No comments
This code show how to send email multiple attachments from vb.net by using System.Net.Mail
1. This is how you use it
1 | Dim fileAttch = New ArrayList |
2 | fileAttch.Add( "C:\test.csv" ) |
3 | fileAttch.Add( "C:\test2.csv" ) |
4 | fileAttch.Add( "C:\test3.csv" ) |
5 |
6 | sendEmail.send(your_emailHost, "no-reply@company.com" , your_EmailTo, your_EmailSubject, your_EmailBody, your_EmailccTo, fileAttch) |