[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using the proper event

Posted on 2004-11-24
6
Medium Priority
?
184 Views
Last Modified: 2010-04-23
The formating now works fine. The problem is that any keystrock calls this and reformats. What event should I be using so that the formating only occurs after I enter the amount and leave the text box with a tab or mouse?

Private Sub TxtinsSelfPayAmt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtinsSelfPayAmt.TextChanged
       Dim SelfPayAmt As Decimal
        If IsNumeric(TxtinsSelfPayAmt.Text) Then
            SelfPayAmt = TxtinsSelfPayAmt.Text
            TxtinsSelfPayAmt.Text = String.Format("{0:c}", SelfPayAmt)
         End If
0
Comment
Question by:rabledsoe
  • 3
  • 2
6 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 12669148
Hi rabledsoe:
What about the LostFocus event?

Dabas
0
 

Author Comment

by:rabledsoe
ID: 12669187
I tried that but I'm not sure I did it right. Can you give me an example?
0
 
LVL 27

Accepted Solution

by:
Dabas earned 2000 total points
ID: 12669252
Private Sub TxtinsSelfPayAmt_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtinsSelfPayAmt.LostFocus
        Dim SelfPayAmt As Decimal
        If IsNumeric(TxtinsSelfPayAmt.Text) Then
            SelfPayAmt = TxtinsSelfPayAmt.Text
            TxtinsSelfPayAmt.Text = String.Format("{0:c}", SelfPayAmt)
         End If
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 27

Expert Comment

by:Dabas
ID: 12669270
And of course, delete your previous TextChanged code, otherwise both of them will be active!
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12669542
I would do it on Leave event
0
 

Author Comment

by:rabledsoe
ID: 12669997
I will check out the leave event, but the lostFocus works perfect. Thanks
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

872 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