Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Accepting Only Alphabet And Numeric Characters


Can someone please help me figure out how to test if value is a - z?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Restrict Users To Enter First Character As Alphabet And Rest As Numeric.
Hi! I'm new in VB6. I would like to know how to make a function that would restrict users to enter a 4 character code and the first character is any of the ALPHABET (A~Z) then the last 3 characters would be NUMERIC (0~9). It must not accept no other symbols and they cannot leave it blank (meaning null).

Example:

Valid code is C105 --> since first character is an alphabet and the rest is numeric

Invalid codes are 9C32
C+54
null

Numeric Characters
Feeling foolish coming up with these silly things but God knows why, the last few days, I've been hamstrung by these trivial errors.

This code does what it is supposed to do only while I step through it. When I run it, whether in the IDE or in the EXE, it does not block non-numeric characters. It let's me enter all kinds of characters.



Code:
Private Sub txtNewIPAddress_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyBack Or vbKeyDelete Or Asc(".") Or vbKeyHome Or vbKeyEnd
Case 48 To 57
Case Else
KeyCode = 0
End Select

End Sub

Numeric Characters
Feeling foolish coming up with these silly things but God knows why, the last few days, I've been hamstrung by these trivial errors.

This code does what it is supposed to do only while I step through it. When I run it, whether in the IDE or in the EXE, it does not block non-numeric characters. It let's me enter all kinds of characters.



Code:

Private Sub txtNewIPAddress_KeyDown(KeyCode As Integer, Shift As Integer)

Select Case KeyCode
Case vbKeyBack Or vbKeyDelete Or Asc(".") Or vbKeyHome Or vbKeyEnd
Case 48 To 57
Case Else
KeyCode = 0
End Select

End Sub

IsNumeric And Non Numeric Characters
In this thread JDT talks about some characters slipping through the IsNumeric function, such as $, '.' or -.

I can understand it when you consider that IsNumeric("$245.53") will return True. But can I safely assume that IsNumeric("$") and IsNumeric(".") will always return False?

Prevent Non-numeric Characters
Is there any way to prevent someone from entering non-numeric characters into a cell on an Excel spreadsheet? There doesn't seem to be any way to detect a change as it's happening, nor does there seem to be anyway to detect when someone's entered a value into a cell and then moved on to another cell, like an onBlur/lostFocus event for cells. Any ideas?

Removing Non-numeric Characters
Hi all,

I'm trying to check a text box to remove any non-numeric characters. Here is the code I'm using:
Code:
Dim i As Integer
For i = 0 To Len(txtPhone.Text)
txtPhone.SelStart = i
txtPhone.SelLength = 1
If IsNumeric(txtPhone.SelText) = False Then
txtPhone.SelText = ""
End If
Next i
The textbox is starting with the following text:
(Extension) 132

And after the check, it gives:
Etnin132

It seems to be skipping every 2nd character....Any ideas why?

Thanks,

Tom

Numeric Characters In A Group
Hello guys!

How do i filter numeric characters in a group of characters?

sample :2% gross income
how do i filter this string so that my program will only read the 2?

thanks!

Seperating Numeric And Characters
Hello everybody,
can anyone help me out in seperating numeric values and characters from textbox.
for eg: if text1.text="prasann123"
then above should be seperated as text2.text=prasann

text3.text 3

Replace All Non-Numeric Characters With XYZ
I know this must seem so simple, so maybe it's cuz I'm deadly tired, but I seriously cannot figure this out.

If I have a string, how can I replace all the non-numeric characters in that string with "XYZ" or something...?????

Accepting Unicode Characters In Unicode Compliant Text Box In Vb 6.0
I want to develop ActiveX control using text box control from frm20.dll. This text box control is unicode complinat. When I enter unicode charaters in this text from VB, it displays extended characters and not the actual characters. But if I read from a text file where unicode characters are written, there characters are displayed properly. Also if I pase unicode text string from other application such as Word, these characters are also displayed properly.


I need some help in writing unicode characters in the text box directly.

Aparna Tamanekar

Can I Remove All Non Numeric Characters From A String?
Greetings all!
Quick question, is there a way that I can remove all the non-numeric characters from a string? Preferably something built into VBA already, but if anyone has any ideas for a descent function to do it I'd be interested in that also.

Thanks!
-Shiv

Extract Non Numeric Characters From String
Is there a function to get only numerics from a string for instance to take a
string containing "345(435),-234." and make it = "345435234"

Thanks
Avi

Determining If Textbox Contains Numeric Or Alphabetic Characters
hi,

I'm using vb and need to test the contents of a text box to determine if the characters in it are numbers or characters.

for example if my textbox contained "apiuhdiu" I need to ignore it, but if it contained "152.235", I need to be able to use that. do you know how to determine which is in the text box?

Thanks,

irishgirl

Filtering A Numeric Text Field For Ints Or Invalid Characters
I currently have a two digit text field. It is imperative that this field be clean, i.e., no letters or weird characters like &$(#

What is the best way to go about doing this. I know there are ways to find what the value at certain positions in a string are but am not sure if this endeavor is something really easy, or something that will need a sub all to itself.

Thanks,

Nightfox02

SENDING Message To Numeric / Alpha Numeric PAGER
Hi,
I want to Send a messages to Numeric / Alphanumeric Pager Using VB Control through Modem. Is it possible to send a message.

Anybody help me for this one.

Thanks in Advance ,
Best Regards,
Jeeva

Validating Input As Numeric, Alpha Numeric Etc.
How can I validate input (String, input form etc) as numeric, alpha numeric etc.

 

Store Combination Of Numeric And Non-Numeric
I have a constant that contains both numeric and non-numeric values, i would like to store it as a string so that after, i retrieve it as the orignal constant. For example.
PX-MN3LT45364 to be stored as GH-GJHJLKJHWE and later get rerieved as PX-MN3LT45364

I know how to use the combination of Chr,Asc and CInt to change string values to numbers and vise-versa but i cant figure out how i can do it to a combination of both.
Any Idea will be highly appreciated.

Numeric Variable && Numeric Literals
Hello
sorry for all the newbie questions, but i am struggling with this book
What is the difference between a numeric variable and a numeric literal?

Alphabet...
Okay this is simple


Code:
Do until Letter = "Z"

Letter = "A"

Letter = Letter + 1?

loop


Okay I know that wont work, but I think you get the idea, I want it to go from A-Z like that, any ideas?

Alphabet
just wondering if 'isalpha' a valid VB function or not . IF not then how can i determine if the a character input is an alphabet

Get Next Alphabet ...
Hi all

I am using VB 5, I want to fetch next alphabet in order through a function
and insert in my database as a code.

For example I want to get A, B, C , D ....., Z, AA, AB, ..... AZ, BA and so
on.

Is this function available in VB 5 or 6 or how can I achieve this?

Thanks

Alphabet
Code:
Option Base 0
Option Base 1
       If a And b Then
     Option Base 0
            Call b
            Do
            Else
            For a = b To c
            GoTo a
            'H
 For Each a In b
            'J
            'K
            Loop
      a = b Mod c
            Next
            Option Explicit
            Print
            'Q
            Resume
            Set a = b
            Type a
        a = UBound(b)
            'V
            While a
       If a Xor b Then
            'Y
            'Z


Paste this into VB6, look for the missing letters

Bring an end to unhappiness...
visit [link removed]

Next Alphabet Letter
Is there an easy way to go to the next alphabet letter? Example:

[vb]MsgBox "a" + 1[vb]

Then the message bx would say "b"

I know this wouldnt work, but is there something that would?

Alphabet ASCII
Im trying to sum up the ascii integer of letters entered into Text1. For example:

Lowercase a-z = Numbers 97-122
a = 97
b = 98
c = 99
etc.

Uppercase A-Z = Numbers 65-92
A = 65
B = 66
C = 67
etc.

And as a user enters or deletes a letter in text 1, i want text 2 to hold the sum of the letters..

So if text1 = "abc" then text2 should be 294.. if a user deletes "c" leaving "ab" in text 1, text2 should be 195..

If this is confusing i can explain more... But the ascii integer codes are universal, so i thought there would be an easy way to do this in vb..

Thank you

Alphabet Or Numbers
Hi!

How can a vbscrit command:

1) read a line
2) if it contains alphabetic characters do something
3) if it contains numbers do something else.

Thank you,

This is making me crazy

Frenz

Loop Through Alphabet
Hi I want to be able to loop through the alphabet, in the same way one can loop through numbers. Pretty simple really, thats why I think there must be some automatic way of doing it.

I tried simply using a for loop on a string, i.e:

dim sChar as string

for sChar = a to z

msgbox sChar

next sChar


But this does not work, please dont tell me that I will have to create some look up function that will convert any number to the corresponding letter of that position in the alphabet. There must be some sort of function already in place in VB?

How To Check For Alphabet
I have a string how do i check if the first character of that string is an alphabet

How To..?: Keep First Alphabet In Capital
I want to keep first alphabet of every word in a text box to be in capital while entering the data...please help me with some coding.

Determine If Alphabet
Does anyone knows how to determine if the user push a keyboard key that is within the alphabets and the numbers.
i want to know if the input is an alphabet, a number or another character. pls. help..

thanks in advance.

Loop An Alphabet
I would like to catch the next letter of the alphabet, but I dont know how.

For i = 1 to 27
   debug.print i + alphabet letter
Next

Would like the result to be like this.
1a
2b
3c

Coloring Your Alphabet
Hi all, i have a small issue. this is my idea for trying to make numbers to color the alphabet. but for some reason i am doing something wrong.. here is my example to make it work. I am a beginner at this..

What I am looken to do..

dim Var
var = chr(94) ' is ^

1 is red
2 is green
3 is blue
4 is black
5 is yellow

so now:

^1B

B is Red

^2i

i is Green

it will be Bi in the label1.caption in there appropriate colors.

what i want to do is that i type this in a text box and fire command by clicking on the button it will show on the label1.caption window in 2 different colors.

I been scratching my head all day long writing simple code but its not working at all.. lol could somebody help me with this?

Thanks

Random Alphabet
How do I make a label show the alphabet randomly?

Auto Increment Alphabet
Hi All,
I am new to VB and im trying to solve a tricky issue.
I am trying to loop through the alphabet a-z and have the vaule appear in a text box on my access form.I also wnat the dat to appear(20060420) before the letter? i dont know how to do this? So everytime a user submits a new record the date will appear with a new letter will appear? the below code works in the befor e_Insert property, but it only increments one letter? Can you enhance this or give me pointers?


Thanks


Code:
Private Sub Form_BeforeInsert(Cancel As Integer)

thisletter = "A"
thisletter2 = "B"


If Me.NewRecord = True Then
nextletter = Chr(Asc(thisletter) + 1)


End Sub

How To Remove All Alphabet From A String
For an example, I have a string of :

AB05D26FD

I would like to remove all alphabet and make the string as "0526"

Can anybody help me with this?

Help! Is There A Way To Show The Alphabet In Text Box?????
Hi I wanted to know if I could get a type of calculation that would put abcd all the way until z in text box instead of writing the 26 letter long alphabet. Like something like this code:


VB Code:
For i = "a" To "z","A" To "Z"


Some function like that.

Truncate Alphabet From String
I'd like to trim leading alphabet from an alpha-numeric string.
For example, suppose str1 = "abcd ef1234", i'd like to be left with only "1234". The string length and leading letters vary. Str1 can sometimes be "ab1234" or "abcd*12" but the end result is always the same, to be left with numbers only.

Fill Listbox With Alphabet
I need to fill a listox with all letters of the alphabet. Is there a function that would do that, like MonthName for months? If not, then any help on constructing a loop that would accomplish this is greatly appreciated.
Thanks,
Michael

Generate The Next Alphabet Sequence
Hello everyone..
Is there a way to generate an alphabet sequence depending on the number of the file?
for example.. if my new document is document nuber 3 i would like it to have the letter C, and so on.

i need this because i'm inserting document information in the database.. each document will have a sequence number.. but if the same document already exist it should be treated as a version of that document and there for will be named 3.A or 3.B and so on..

can anyone guide me please,, is there a defined method like in the java?

thanks

Increment For A Number With The Alphabet...
Dear all,

Can anyone teach me how to increase the number with the alphabet as well?

For Example, "A00001", everytime, when i click the command button, it will automatically + 1, "A00001" -> "A00002-> "A00003 -> "A00004 -> ... until "A99999"

Many Thanks...

Regards,
Nicholas

Remove Unwanted Alphabet From A Number
1) In column A, I have a list of reference no. which starts from an aphabet followed by numbers. For example, H1234, P56789 ........ How to remove the alphabet from the numbers to become 1234 and 56789 ?

2) In column B, I have a list of name. Some names has '+', '++' or '#' sign infront of them. For example, '+John'. How to remove the these signs from the names ?

Appreciate your help to resolve the above problems. THank you !

Text Box Validation - Only Allowing Alphabet
I'm trying to validate a textbox so that only the alphabet can be entered, to be used for entering a person's name. I've used:

VB Code:
Private Sub            Text2_Change()             If IsNumeric(Text2.Text) Then            MsgBox "You entered a number", vbOKOnly, "Error"            End If End Sub


But that only works if the only characters that are entered are numbers, if i enter a few letters followed by a number, the message box doesn't pop-up.

Can anyone help? Tom

Alphabet Order On Excel Sheet
Hi,

I have a excel sheet filled up with certain info, I have these cells C11 to C15 and D11 to D15 that holds info that I want to sort alphabetical I can do the sort in excel by going to sort and sorting by C11 how can i do this sort in VB?
Thanks

Hugh

How To Show German Or French Alphabet?
I use chr() in VBA to do this, everything is ok, But in VB I can see nothing!

Could anyone tell me the right method? Thanks.

ps: My Word and VB are all Traditional Chinese edition.

Reading And Displaying Cyrillic Alphabet
Have several .rtf file want to read and display in vb6.0

Disable The Alphabet And Also Funny Symbol
I woul Like to disable the alphabet and also funny texts into the text box...
is that possible?

How To Add The Alphabet Alongside Random Letters Ie: A=e/b=y/c=w
Gday,
Just like the Subject line said... I have been trying to create something that would look like this if it worked:

"a=q/b=g/c=d/d=e/e=3/f=r/g=t/h=y/i=8/j=u/k=i/l=o/m=j/n=h/o=9/p=0/q=1/r=4/s=w/t=5/u=7/v=f/w=2/x=s/y=6/z=a"

I have been trying to create a Password Builder that builds the password randomly from the webpage your signing into and the username you use.
Here is where I get stuck. I can create the random side. Or, the Alphabet side of the '=' but I dont know how to join them together so it looks like the above sample.

I get this:
"=m/=e/=w/=c/=f/=n/=l/=k/=j/=q/=i/=r/=h/=a/=t/=y/=b/=s/=x/=o/=v/=g/=u/=z/=p/=d/"

I DONT KNOW WHAT IM DOING!


Here is what I have:

Public Function RandomLetters() As String
Dim Letters As String
Dim Alphabet As String

Letters = "abcdefghijklmnopqrstuvwxyz"

Randomize
Dim i As Long
Dim Index As Long
For i = 1 To Len(Letters)
    Index = Fix(Rnd * Len(Letters)) + 1
    RandomLetters = RandomLetters & "=" + Mid$(Letters, Index, 1) & "/"
    Letters = Left$(Letters, Index - 1) + Mid$(Letters, Index + 1)
Next
End Function

Private Sub Command1_Click()
FileNumber = FreeFile
Open CodeFileName For Output Shared As #FileNumber
   Write #FileNumber, Text1.Text
Close #1
End Sub

Private Sub Form_Load()
CodeFileName = APP_PATH & "keydata.uck"
Text1.Text = RandomLetters
Text1 = Replace(Text1, "//", "/")

End Sub


Could somebody please steer me in the right direction. I dont seem to be getting any closer.
Thanks

Accepting Parameters
In a VB app, how would I accept parameters coming from the command line? E.g. myvbapp.exe -param1 -param2, etc?

Accepting Numbers Only
i got a program...i want the text boxes to only accept numbers..what do i need to do?? can someone help please.

Copyright 2005-08 www.BigResource.com, All rights reserved