
disabling the space key or removing a space from a string
Quote:
> Dose anyone know how to disable a key Example being the space key. or how
to
> take out letters from a string if you don't knwo there position??
If you've got VB6, then use the Replace function and replace all " " with
"". If you are using something else, you will have to manually use the
Instr function and find spaces, then zap them from there. If for some odd
reason you need the length of the string to work those other functions, use
the Len(stringName) function.
Quote:
> i can use
> trim(strString)
> to get rid of ending spaces but i don't know how to get the space out of
a
> string like this "hi there" if i don't know the lenght of the string
mainly
> becasue i want the string not to have the space to begin with becasue it
> will be displayed as it is typed.
> also is there a way that i can set up a text box so that only numbers cam
be
> typed??
Yeah, there are several ways. You could just use a Masked Edit box and
limit the character input to numbers. However, there can be problems with
that. You can also check things in the KeyPress and KeyUp events and then
change them to character 0 if it isn't a number. However, there are some
problems with that too (like what happends when someone presses the Negative
sign or a decimal point or two. Also, what happends when someone just
pastes stuff in from the clipboard?).
If you want, you can goto my web page and download my Numeric Input Box
ActiveX control. It will include some features which you may or may not
want, but it is also free with complete source code, so you could read what
I've written to keep things numerical. (I'm afraid my code may be a little
messy, though, because I wrote that one only as a quick test).
--
Howard Henry 'Gawyn Ballpeen' Schlunder
Gawyn Developments; Core developer
http://www.*-*-*.com/ ~hschlund/