GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Microsoft  >  Visual Basic

 Print  |  
Question:  Displaying leading/trailing zero in text box

Answer: Hi,
i have many text boxes to input numeric values in the form. The problem is when my text box lost its focus , if any numeric value entered in text box without any dismal place will automatically display 2 dismal zero. else if no values entered in the text box it should display 0.00 value in it .
ex : if i enter a value in the text box : 25 when it lost focus the values should 25.00
if doesn't enter any value in text box, when it lost focus the value should be 0.00


February 02, 2008 07:03:59 #1
 amolsarwade   Member Since: February 2008    Total Comments: 1 

RE: Displaying leading/trailing zero in text box
 

You can do so with textbox LostFocus e.g.
Private Sub Text1_LostFocus()
    Text1.Text = Format(Text1.Text, "0.00")
End Sub

     

 

Back To Question