Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Validate Alphanumeric

I want to validat a user entry into a textbox.

I use trim to remove blanks and I test for NULL

But if the user presses Ctrl+Tab it enters a tab character in the
textbox.

The entry the user makes can contain numbers or letters, how do I stop
ctrl+tab from entering a tab in the textbox?

I am using keydown and keypress to look for "tab" (tab forwards) and
"Shift and Tab" (tab backwards). It works, the tab key does tab to the
next box, "Shift and Tab" does tab to previous box, but "Ctrl and Tab"
enters a tab in the textbox, I have found a reference that ctrl and tab
will be ignored when multiline=false (which it is). Can I simply ignore
off "Ctrl+Tb"?

A better solution would be to test that input is alphanumeric as I may
run accross other strange user inputs, I can only find IsNumeric in
Excel VB. Anyway of only allowing "Shift+Tab", Tab, Backspace, arrows
and alphanumeric input? (Note I also have to allow Swedish letters åäö
and ÅÄÖ. (But I know the ascii values for these).

Garry Jones
Sweden
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Validate Alphanumeric

How about using the CLEAN() worksheet function which removes all
non-printing characters. eg. ..
mystring = Application.WorksheetFunction.Clean(Me.TextBox1.Va lue)

Regards
BrianB
================================================== ==


Garry Jones wrote in message ...
I want to validat a user entry into a textbox.

I use trim to remove blanks and I test for NULL

But if the user presses Ctrl+Tab it enters a tab character in the
textbox.

The entry the user makes can contain numbers or letters, how do I stop
ctrl+tab from entering a tab in the textbox?

I am using keydown and keypress to look for "tab" (tab forwards) and
"Shift and Tab" (tab backwards). It works, the tab key does tab to the
next box, "Shift and Tab" does tab to previous box, but "Ctrl and Tab"
enters a tab in the textbox, I have found a reference that ctrl and tab
will be ignored when multiline=false (which it is). Can I simply ignore
off "Ctrl+Tb"?

A better solution would be to test that input is alphanumeric as I may
run accross other strange user inputs, I can only find IsNumeric in
Excel VB. Anyway of only allowing "Shift+Tab", Tab, Backspace, arrows
and alphanumeric input? (Note I also have to allow Swedish letters åäö
and ÅÄÖ. (But I know the ascii values for these).

Garry Jones
Sweden

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
validate wAYNE Excel Discussion (Misc queries) 1 March 1st 10 06:21 PM
validate kyoshirou Excel Discussion (Misc queries) 18 June 6th 07 01:08 AM
Looking up a name and then being able to validate it twynsys Excel Worksheet Functions 0 November 29th 06 02:48 PM
Looking up a name and then being able to validate it twynsys via OfficeKB.com Excel Worksheet Functions 0 November 21st 06 04:43 PM
How to validate edwardpestian Excel Worksheet Functions 4 June 9th 06 01:13 AM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"