Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Decimal Validaton

Posted on 2003-03-25
9
Medium Priority
?
246 Views
Last Modified: 2010-04-17
hi there,

can anyone help me with validation process. i want to check whether a value entered ina text field is not decimal. if it is decimal, then a msb prompts for a message else if the value entered is int.. message ok.

thanks
yogesh
0
Comment
Question by:yogeshk
  • 2
  • 2
  • 2
  • +2
8 Comments
 

Author Comment

by:yogeshk
ID: 8207413
urgent please
0
 

Author Comment

by:yogeshk
ID: 8207418
that site is really great
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 80 total points
ID: 8207626
you want to determine if the value entered in a TextBox is a NUMBERwith a deciml point?

try this:

Private Sub txtValue_Validate()
   if isNumeric(txtValue.Text) then
      if instr(txtValue.Text,".")>0 then
            MsgBox "Value IS a DECIMAL value", vbokonly
      else
            MsgBox Value is an INTEGER", vbOkOnly
      end if
   Else
     MsgBox "Value is NOT a valid Number", vbokonly
   end if
End Sub

that should test properly...

Arthur Wood
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 8207628
oh yeah, that code is Visual Basic...you did not mention what programming language you needed.

AW
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 8207960
Java:

String str = myTextField.getText () ;
int len = str.length () ;

for ( int i = 0 ; i < len ; i ++ )
  if ( ! Character.isDigit ( str.charAt ( i ) ) && str.charAt ( i ) != '.' )
  {
    System.out.println ( "\n Invalid number. "  ) ;
    break ;

  } // end if, for


Mayank.
0
 

Expert Comment

by:raseniero
ID: 8256009
try this one!

if isnumeric(txtdecimal.text) then
   msgbox "Valid Decimal"
else
   msgbox "Invalid Decimal"
end if
0
 

Expert Comment

by:CleanupPing
ID: 9446785
yogeshk:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 9451891
Well, we still don't know which programming language he was looking for! Else, split points between mayankeagle and Arthur_Wood.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
When you discover the power of the R programming language, you are going to wonder how you ever lived without it! Learn why the language merits a place in your programming arsenal.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Screencast - Getting to Know the Pipeline

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question