473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

ucase

lee123
556 512MB
how do you change a certsain field to all caps i have tried this statement but didn't work:

Expand|Select|Wrap|Line Numbers
  1. txtcompanyname.seltext = ucase(txtcompanyname.Seltext)
is this correct or what else do i need to add

ps. i put this in the form load event does that matter?

lee123
Jan 13 '08 #1
6 2995
Killer42
8,435 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. txtcompanyname.seltext = ucase(txtcompanyname.Seltext)
This statement should do the trick.

But note that as with any other statement, it only does its job once, when you execute it. So if it is done in the Form_Load event, it will happen once while the form is being loaded. If there's nothing in the textbox at that time, it won't have any effect.

Hm... on further consideration, I doubt this will ever have any effect. Because you are referring to SelText, which is presumably the selected part of the text. How could you have selected any of the text before the form is even displayed?
Jan 13 '08 #2
lee123
556 512MB
hey killer42,

so how do i make it so when i enter in the name it comes out in caps if the caps is not on.

by the way i got this code out of a book as an example

lee123
Jan 13 '08 #3
Killer42
8,435 Expert 8TB
Well, you put this code where you want it to execute. For instance, if you want it to happen every time the user presses a key, you'd put it in the textbox's KeyDown or KeyPress event procedure. However, if you're not careful this can mess up the user by changing their cursor position within the text while they're typing - not nice. Possibly a better point to do it is when the focus leaves the textbox (LostFocus event).

Note that I'm referring to events in VB6. The names and so on may vary slightly in your version. Judging by the use of .SelText I'm guessing this is a later version than mine.

Also, keep in mind whether you want to adjust all of the textbox contents, or just the part which is currently selected. My guess is that the .SelText property refers to the latter. For the entire contents you'd probably want to use either .Text or .Value property.


P.S. It would really help if you fill us in on some background. Such as what version of VB you're using, what you mean by a "field" and so on. I've been assuming you're referring to a textbox control.
Jan 14 '08 #4
lee123
556 512MB
Ok im using vb6 and i just wanted to (cap) a textbox named (txtcompanyname)
the (seltext) i got from a book named mastering visual basic 6.0 i guess i was just looking what i could do for this textbox to have enter all caps in this box only.

lee123
Jan 14 '08 #5
lee123
556 512MB
oops wrong button any thanks killer42 it works now.

lee123
Jan 14 '08 #6
Killer42
8,435 Expert 8TB
oops wrong button any thanks killer42 it works now.
Glad to hear you've sorted it out. :)

Oh, and I made a big goof in my earlier post. SelText is a property of textboxes in VB6. I had just forgotten it.
Jan 14 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Thomas McK | last post by:
Hi all, I'm trying to make a SQL query (against a table in MS Access) where I want to take the value of something, and check to see if the first two letters in that value are capitalized (for...
12
by: MLH | last post by:
Have had a runtime installation up for 4 months. Upgraded today with new ver 0.07 from 0.06. On launch, error reported... Err in fn Initialize, module AutoExec, function isnt available in query...
7
by: tsnyder | last post by:
I need to define a field so that when a lowercase letter is put in the field it turns to an uppercase letter. What would the expression for the field be? My field name is site_id.
5
by: Todd Snyder | last post by:
I need to make a field put uppercase letters in it when a lowercase letter is entered into that field. Is there an expression to use or does it have to be written in code? *** Sent via...
16
by: shawno | last post by:
I'm relatively new to DB2 and have noticed a problem with my queries when doing a like with ucase. Since queries need to be case insensitive, I have to do a ucase on the column(s) being searched...
7
knychtell
by: knychtell | last post by:
Hi there!, i got a problem with classes, can somebody help me with it? i have created a login form(basic login form) with 2 txtboxes and a pair of buttons, how can i use the LCASE or UCASE, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.