|
-
Aug 29th, 2000, 10:01 AM
#1
Thread Starter
Addicted Member
I have made my cmdRun button a default button. My question is how can I get my textbox to capitalize once I press enter to run the program. I have a lost_focus routine and in my cmdRun sub I have the txtCubeCupName ucasing and trimming plus I have it so it setfocus. Does anyone have suggestions?
-
Aug 29th, 2000, 10:15 AM
#2
Lively Member
command button
Make sure you have your command button default property set to true and then in the cmdRun_click sub you want a statement like
txtCubeCupName.text = Trim$(UCase$(txtCubeCupName.text))
-
Aug 29th, 2000, 10:23 AM
#3
Thread Starter
Addicted Member
I did that and it didn't work. Thank you for your help though. Any other suggestions?
-
Aug 29th, 2000, 10:26 AM
#4
Addicted Member
or how about after making cmdrun default use this
var = len(txtcubecupname)
sng1 = left(txtcubecupname,1)
sng2 = middle(txtcubecpname,2,var)
txtcubecupname = var
simpler code, though a bit longer
-
Aug 29th, 2000, 10:26 AM
#5
Lively Member
Maybe I don't get your question but it works fine for me. What version of VB are you using?
-
Aug 29th, 2000, 10:29 AM
#6
Lively Member
Chris_SE
Why are you populating the text box the the len of what the text box was before?
-
Aug 29th, 2000, 10:33 AM
#7
Thread Starter
Addicted Member
I'm using Visual Basic 6.0
-
Aug 29th, 2000, 10:35 AM
#8
Lively Member
-
Aug 29th, 2000, 10:41 AM
#9
Thread Starter
Addicted Member
posting code
This is in my cmdRun sub:
If UCase(Trim(txtCubeCupName)) = "" Then
MsgBox "The Cube Cup Name must be entered."
txtCubeCupName.SetFocus
Exit Sub
End If
And then I have a Lost_Focus event:
Private Sub txtCubeCupName_LostFocus()
txtCubeCupName = UCase(Trim(txtCubeCupName))
End Sub
-
Aug 29th, 2000, 10:48 AM
#10
Lively Member
In your cmdRun_click add the this line - cmdrun.setfocus. Look at the code below.....
Private Sub cmdRun_Click()
If UCase(Trim(txtCubeCupName)) = "" Then
MsgBox "The Cube Cup Name must be entered."
txtCubeCupName.SetFocus
Exit Sub
End If
cmdRun.SetFocus
End Sub
Private Sub txtCubeCupName_LostFocus()
txtCubeCupName = UCase(Trim(txtCubeCupName))
End Sub
-
Aug 29th, 2000, 10:54 AM
#11
Thread Starter
Addicted Member
It still doesn't capitalize the data in the txtcubecupname.
But thanks for your help. Is this even possible?
-
Aug 29th, 2000, 11:05 AM
#12
Lively Member
I am using the same code as you and when I press enter it capatilizes the text box like it is suppose to. Go in debug mode and make sure that your code is executing the cmdRun_click when you hit the enter button. If it doesn't then you must not have the cmdRun set to default
-
Aug 29th, 2000, 11:13 AM
#13
_______
<?>
put this in the keypress of the textbox in question:
Code:
'vb6
'capitalize all small case letters
'
If Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z" Then
KeyAscii = KeyAscii - 32
End If
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 29th, 2000, 11:19 AM
#14
transcendental analytic
Here's an alternative to HeSaidJoes code that will capitalize all åäöüï characters
Code:
KeyAscii=Asc(Ucase(Chr(KeyAscii)))
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 29th, 2000, 11:22 AM
#15
Thread Starter
Addicted Member
Hey thanks HeSaidJoe that keypress worked. Thanks thedee23 for being patient with me and all your help.
-
Aug 31st, 2000, 05:28 PM
#16
Addicted Member
Sorry, my code got cut off
or how about after making cmdrun default use this
var = len(txtcubecupname)
sng1 = left(txtcubecupname,1)
sng2 = middle(txtcubecpname,2,var)
var = sng1 & sng2
txtcubecupname = var
this should be the full thing
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
|