|
-
Mar 11th, 2011, 02:08 AM
#3
Thread Starter
New Member
Re: NULL - Interger input - VB.X (2010)
 Originally Posted by jmcilhinney
Integer variables can only contain Integer values. You don't use DBNull at all except when transferring NULL values to or from a database using ADO.NET.
You don't need a hack. If you were to explain what you're actually trying to achieve then we could explain the proper way to achieve it.
Thanks for reply, jmcilhinney
Ok, i'm try to achieve a proper input box. which only allow integer . backspace, null (empty), char or string is not allowed... but i could not configure it.. i create a function to call by a button. i has been mod my code.. now it look like below :
Code:
Private Sub GetDataToDGV()
Dim row As Integer = DataGridView1.Rows.Count
Dim n1 As String
Dim N As Integer
Do
n1 = InputBox("Enter the number of order :")
If n1 <> "" Then
MessageBox.Show(n1)
N = Convert.ToInt32(n1)
Else
MessageBox.Show("Wrong input! Please try again!")
End If
Loop Until n1 <> String.Empty
Dim jumlah As Decimal
jumlah = Decimal.Round(N * txt_harga.Text).ToString("f2")
Me.DataGridView1.Rows.Add(row, kodMakanMinum, txt_foodDrinkName.Text, N, jumlah)
End Sub
so.. i has settle the null input! 
but... i still has problem , when end-user input backspace, null (empty), char or string.
here.. a screenshot :

hurmm..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|