Search This Blog

Monday, August 16, 2010

Visual Basic Text Box tips

Some tips you like use in vb text box

(a) In text box all in Capital letter use below

Private Sub Text1_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Details Description:
First keyascii code convert into character , it is converted into capital letter agin then it is converted into keyascii code.

(b) allow only number in text box

Private Sub Text1_KeyPress(KeyAscii As Integer)
If IsNumeric(Chr(KeyAscii))=False then keyascii=0
End Sub

(c) Not allow number in text box like name field
Private Sub Text1_KeyPress(KeyAscii As Integer)
If IsNumeric(Chr(KeyAscii))=True then keyascii=0
End Sub

(d) Make a currency text box you can use like this

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Len(Text1.Text) = 0 Then Exit Sub
If InStr(1, Text1.Text, ".") Then KeyAscii = 0
End Sub

5 comments:

  1. good blogging site. that concept is basically horrible nonetheless. if you want a different one you possibly can down load numerous advanced on-line, its going to start looking greater.

    ReplyDelete
  2. What an ineresint article. We are really glad. Maintain doing good job man

    ReplyDelete
  3. I must administrator that i perform such as your blog. It is not as 1000's other individuals, yet a bit distinct so that it is a lot more intriguing, notable and readable. Many thanks partner regarding doing a good task. Just one single feel * put the mention of the anyone content

    ReplyDelete
  4. nice web site. the particular topic is basically horrible despite the fact that. if you require a different one you can download some quality on the web, it will search significantly better.

    ReplyDelete
  5. Precisely what an amazing news. I'm trully impressed. Maintain doing good job mate

    ReplyDelete