<script type="text/javaScript">
//เติม , (คอมมา)
function dokeyup( obj )
{
var key = event.keyCode;
if( key != 37 & key != 39 & key != 110 )
{
var value = obj.value;
var svals = value.split( "." ); //แยกทศนิยมออก
var sval = svals[0]; //ตัวเลขจำนวนเต็ม
var n = 0;
var result = "";
var c = "";
for ( a = sval.length - 1; a >= 0 ; a-- )
{
c = sval.charAt(a);
if ( c != ',' )
{
n++;
if ( n == 4 )
{
result = "," + result;
n = 1;
};
result = c + result;
};
};
if ( svals[1] )
{
result = result + '.' + svals[1];
};
Private Sub TextQTY_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtQTY.KeyPress
If txtQTY.Text = "" Then
Dot = True
Sum = 0
DotPoint = 0
End If
If (e.KeyChar = ".") And Dot Then
Dot = False
Else
If ((e.KeyChar < "0") Or (e.KeyChar > "9")) And (e.KeyChar <> "") Then
e.Handled = True
End If
If Key = 8 Or Key = 46 Then
If Sum <> 0 Then
Sum = Sum - 1
If DotPoint = Sum Then Dot = True
End If
Else
Sum = Sum + 1
If Key = 110 Then
DotPoint = Sum
End If
End If
End If
End Sub