|
-
Jun 6th, 2003, 06:39 AM
#1
Thread Starter
Lively Member
Textbox Edit Mask
I have a textbox used to enter date, and I would like to use and edit mask __/__/____ so user don't have to enter "/"
Idem for numerix textbox, is there a method to allow only numeric value inside textbox ?
and last one an edit mask which put all in lower case exept the first letter in uppercase.
duPOnt => Dupont
Thanks
-
Jun 6th, 2003, 07:34 AM
#2
Sleep mode
This allows only numeric values .
VB Code:
Dim KeyAscii As Integer
KeyAscii = Asc(e.KeyChar)
Select Case KeyAscii
Case Asc("0") To Asc("9")
e.Handled = False
Case Else
e.Handled = True
End Select
-
Jun 6th, 2003, 07:35 AM
#3
Sleep mode
Put that code into keypress event of the specified textbox .
-
Jun 6th, 2003, 08:08 AM
#4
Thread Starter
Lively Member
-
Jun 10th, 2003, 10:52 PM
#5
New Member
Textbox Edit Mask
The textbox object has a property called CharacterCasing which you can set to force all characters to lower case.
-
Jun 11th, 2003, 06:12 AM
#6
Sleep mode
Originally posted by skaterx2
The textbox object has a property called CharacterCasing which you can set to force all characters to lower case.
This does the same .
VB Code:
TextBox1.Text = StrConv(str, VbStrConv.LowerCase)
-
Jun 11th, 2003, 06:24 AM
#7
Thread Starter
Lively Member
And to put only the first caractere in uppercase :
aPpLe = Apple ???
-
Jun 11th, 2003, 06:31 AM
#8
Sleep mode
VB Code:
TextBox1.Text = StrConv(str, VbStrConv.ProperCase)
-
Jun 12th, 2003, 08:05 AM
#9
Thread Starter
Lively Member
Thanks but it change the first letter of all words in the textbox
What I would like is to change only the first Letter of the first word.
I thinks I'll need to create a small function for that.
Do I need to create a class when I create a function that can be used by all my forms ?
What could be the code ?
Thanks to all for your support, I'll finish my application this WE.
It's great to find peoples who are sharing their knowledge
-
Jun 12th, 2003, 09:13 AM
#10
Sleep mode
You don't need to create new class , just paste the code below in a module file then you can call it from anywhere within your project .
VB Code:
Public Function MyFunction(ByVal ProcessStr As String) As String
Dim CaptL As String = UCase(RSet(ProcessStr, 1))
Dim ResultStr As String
ResultStr = CaptL + ProcessStr.Remove(0, 1)
Return ResultStr.ToString
End Function
Usage (one way like this ) :
VB Code:
MessageBox.Show(MyFunction(TextBox1.Text))
-
Jun 12th, 2003, 02:43 PM
#11
Thread Starter
Lively Member
-
Jun 12th, 2003, 06:40 PM
#12
Frenzied Member
why not use the DateTimePicker?
It's tough being an unhandled exception...
___________
VB.NET 2008
VB.NET 2010
ORACLE 11g
CRYSTAL 11
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
|