Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > อิอิ พี่ ๆ คะ ช่วยเข้ามาดูนี่หน่อยเรื่อง asp.net



 

อิอิ พี่ ๆ คะ ช่วยเข้ามาดูนี่หน่อยเรื่อง asp.net

 



Topic : 009261

Guest




คือว่า อายกทราบวิธีเขียนโค้ด การรับค่าตัวเลข แล้วแปลงเป็นตัวหนังสือ
เข่น
ใช้ text box รับค่าตัวเลข 94632 แล้วกดปุ่ม button
แล้วจะแสดงผลออกมาเปตัวหนังสือ ว่า "เก้า หมื่น สี่ พัน หก ร้อย สาม สิบ สอง"
ช่วยหน่อยนะคะ


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 25 ก.ค. 2549 23:48:35 By : Mintz View : 2287 Reply : 1
 

 

No. 1

Guest


Public Function BahtText(ByVal InputCurrency As Double) As String
' check for negative val
If InputCurrency < 0 Then
InputCurrency = -InputCurrency
BahtText = "ลบ"
End If

StrTmp1 = Format(InputCurrency, "0.00") ' rounds up to 2 decimals
InputCurrency = Val(StrTmp1)
IntegerValue = Int(InputCurrency) ' get integer value
DecimalValue = (InputCurrency - IntegerValue) * 100 ' get 2 decimal values

' check for zeto val
If IntegerValue = 0 And DecimalValue = 0 Then
Satang = "ศูนย์บาทถ้วน"
GoTo locExit
End If

' translate integer val to name if necesary
If IntegerValue > 0 Then
StrTmp = Left(StrTmp1, Len(StrTmp1) - 3) ' get string of integer val
StrLen = Len(StrTmp) ' get string len
CurrDigit = 0

' scan integer string and compute its name
For ScanDigit = StrLen To 1 Step -1
' save previous digit
PrevDigit = CurrDigit
' get digit base
DigitBase = ScanDigit Mod 6
' convert digit character to numeric value
CurrDigit = Asc(Mid(StrTmp, StrLen - ScanDigit + 1, 1)) - 48
' get unit name from its base
UnitSave = RTrim(Mid(UnitName, DigitBase * 5 + 1, 5))
' get number name from Currdigit, depends on the digit base
DigitSave = RTrim(Mid(IIf(DigitBase = 2, DigitName1, DigitName), CurrDigit * 5 + 1, 5))

' base ten and number 1
If DigitBase = 1 And CurrDigit = 1 And PrevDigit <> 0 Then
DigitSave = "เอ็ด"
End If

If DigitBase = 2 And CurrDigit = 1 Then
DigitSave = ""
End If

' first digit base may be base million or 1
If DigitBase = 1 And ScanDigit < 6 Then
UnitSave = ""
End If

' ignore add digit name in result string if it is zero
If CurrDigit <> 0 Then
BahtText = BahtText + DigitSave + UnitSave
ElseIf DigitBase = 1 Then
BahtText = BahtText + UnitSave
End If
Next ScanDigit

BahtText = BahtText + "บาท"
End If

' if no decimal value
If DecimalValue = 0 Then
Satang = "ถ้วน"
' compute decimal val to name, there are only 2 digit
Else
StrTmp = Right(StrTmp1, 2)

' name ot first digit
CurrDigit = Asc(Left(StrTmp, 1)) - 48
PrevDigit = CurrDigit

If CurrDigit > 0 Then
If CurrDigit = 1 Then
Satang = "สิบ"
Else
Satang = RTrim(Mid(DigitName1, CurrDigit * 5 + 1, 5)) + "สิบ"
End If
Else
Satang = ""
End If

' name of last digit
CurrDigit = Asc(Right(StrTmp, 1)) - 48

If CurrDigit > 0 Then
Satang = Satang + IIf(CurrDigit = 1 And PrevDigit <> 0, "เอ็ด", RTrim(Mid(DigitName, CurrDigit * 5 + 1, 5)))
End If

' store result and unit
Satang = Satang + "สตางค์"
End If

locExit:
' store result to BahtText
BahtText = BahtText + Satang
End Function






Date : 28 ก.ค. 2549 03:19:46 By : ASP อ่อนหัด
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : อิอิ พี่ ๆ คะ ช่วยเข้ามาดูนี่หน่อยเรื่อง asp.net
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่