In VB6, I had some code which 'forced' the first character of a string entered
to be Capital. For example, if a person was entering their name (john doe)...
the code would 'force' --- John Doe.
Here is what I believe is the VB6 code:
Private Sub txbModUser_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles txbModUser.TextChanged
KeyAscii = AutoType(Screen.ActiveControl, KeyAscii)
End Sub
Public Function AutoType(ByVal c As Control, ByVal KeyAscii As Integer) As
Integer
' Forces Uppercase for First Character in String
AutoType = KeyAscii
If KeyAscii > 95 And KeyAscii < 123 Then
If c.SelStart = 0 Then
AutoType = AutoType - 32
ElseIf Mid$(c.Text, c.SelStart, 1) < "!" Then
AutoType = AutoType - 32
End If
End If
End Function
Is there a way to do this in VB.net?
Also, how can I toggle the Caps Lock Key? I know it's something to do with
"System.Windows.Forms.Keys.CapsLock". But how to test for it on/off?
Thanks!
Bruce 8 7606
Hi Mr. B,
Take a look at:
str = StrConv(str, vbProperCase)
Cor
Hi, It's easier than you think, in VB.NET and in VB6:
Dim strName As String = "tom spink"
strName = StrConv(strName, VbStrConv.ProperCase)
MsgBox(strName)
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
"Chaos, Panic, Disorder, my work here is done"
"Mr. B" <Us**@NoWhere.Com> wrote in message
news:ek********************************@4ax.com...
: In VB6, I had some code which 'forced' the first character of a string
entered
: to be Capital. For example, if a person was entering their name (john
doe)...
: the code would 'force' --- John Doe.
:
: Here is what I believe is the VB6 code:
:
: Private Sub txbModUser_TextChanged(ByVal sender As System.Object, ByVal
e As
: System.EventArgs) Handles txbModUser.TextChanged
: KeyAscii = AutoType(Screen.ActiveControl, KeyAscii)
: End Sub
:
: Public Function AutoType(ByVal c As Control, ByVal KeyAscii As Integer)
As
: Integer
: ' Forces Uppercase for First Character in String
: AutoType = KeyAscii
: If KeyAscii > 95 And KeyAscii < 123 Then
: If c.SelStart = 0 Then
: AutoType = AutoType - 32
: ElseIf Mid$(c.Text, c.SelStart, 1) < "!" Then
: AutoType = AutoType - 32
: End If
: End If
: End Function
:
:
: Is there a way to do this in VB.net?
:
: Also, how can I toggle the Caps Lock Key? I know it's something to do
with
: "System.Windows.Forms.Keys.CapsLock". But how to test for it on/off?
:
: Thanks!
:
: Bruce
Hello,
"Mr. B" <Us**@NoWhere.Com> schrieb: In VB6, I had some code which 'forced' the first character of a string entered to be Capital. For example, if a person was entering their name (john doe)... the code would 'force' --- John Doe.
[...] Is there a way to do this in VB.net?
\\\
s = StrConv("john doe", VbStrConv.ProperCase)
///
Also, how can I toggle the Caps Lock Key? I know it's something to do with "System.Windows.Forms.Keys. CapsLock". But how to test for it on/off?
Untested:
\\\
MsgBox((Control.ModifierKeys And Keys.CapsLock) = Keys.CapsLock)
///
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
With Deft Fingers, "Cor" <no*@non.com> wrote: Hi Mr. B, Take a look at: str = StrConv(str, vbProperCase)
Yeah! Thanks!
Bruce
With Deft Fingers, "Tom Spink" <th**********@ntlworld.com> wrote: Hi, It's easier than you think, in VB.NET and in VB6:
Yeah it sure was/is!
Thanks!
Bruce
With Deft Fingers, "Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote: Is there a way to do this in VB.net? s = StrConv("john doe", VbStrConv.ProperCase)
Thanks. That seems to be 'the' way. something to do with "System.Windows.Forms.Keys. CapsLock". But how to test for it on/off? Untested: MsgBox((Control.ModifierKeys And Keys.CapsLock) = Keys.CapsLock)
Well I get "False" in both cases (on/off). I'll play with it a bit.
Thanks.
Bruce
Hello,
"Mr. B" <No*****@address.not> schrieb: Untested: MsgBox((Control.ModifierKeys And Keys.CapsLock) = Keys.CapsLock)
Well I get "False" in both cases (on/off). I'll play with it a bit.
Sorry, that won't work. Forget about that. You will have to use pinvoke
with 'GetAsyncKeyState'.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
With Deft Fingers, "Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote: Sorry, that won't work. Forget about that. You will have to use pinvoke with 'GetAsyncKeyState'.
Not to worry... with your 'leeetttlle' bit o' code, it resolved the 'need' to
check for Caps Lock (I was going to 'force' lower case input, then capitalize
the first letter). Nada now (:
Thx
Bruce This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Aaron |
last post by:
string a = "i have an apple";
i want the output to be "I Have An Apple";
i was able to capitalize the first word but can't figure out how to
capitalize every word in that string
Thanks,...
|
by: Marek Mand |
last post by:
<script>
var newval = '';
var name = 'marek mänd-österreich a';
// http://www.faqts.com/knowledge_base/view.phtml/aid/15940
correctedname = name.replace(/\b\w+b/g, function(word) {
return ...
|
by: sams |
last post by:
First, I'll tell you up front that I am clueless when it comes to
Javascript. So I apologize if this question is off topic.
I have a nice little Javascript that capitalizes each field in my...
|
by: gil |
last post by:
I have a script that will capitalize the first letter of every word in
my descriptions. But some of my descriptions contain ( ) and /. For
example bezel (black). I need the script to capitalize...
|
by: DDK |
last post by:
What is the best way to capitalize the first letter of a string?
Thanks for any help,
d.
|
by: Mr. B |
last post by:
In VB6, I had some code which 'forced' the first character of a string entered
to be Capital. For example, if a person was entering their name (john doe)...
the code would 'force' --- John Doe.
...
|
by: blyxx86 |
last post by:
I have the code to capitalize an entire string when it is input, but would like to capitalize just the first letter of a box, or match the case of a drop down list..
My current code is thus:
...
|
by: fAnSKyer/C# newbie |
last post by:
Sorry for this stupid question.
I am using c way s = s -'a' +'A'
but I can't compile it.
Thanks for your kind help
Best wishes
|
by: jackson.rayne |
last post by:
Hello,
I am a javascript newbie and I'm stick at one place.
I have a requirement where I will get a sentence in a variable
example
var v1 ="This is a sentence"
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |