|
-
Sep 14th, 2000, 09:36 PM
#1
Thread Starter
Junior Member
I know it should be easy,but I am new to vb.
I have to read a text file and validate it.
there is an information that starts ona sertain position and is 70 characters long.It comes in a format like this.
for example:lastname *firstname*mi* i have to validate it so when it finds the first asterisk its the end of the last name and so on.if there is first or middle missing add another*
Thank you
-
Sep 14th, 2000, 09:42 PM
#2
Frenzied Member
I'm not 100% sure what you are saying, but why not have seperate text boxes for the fields and then for the command button you put:
Code:
If txtFirstName.text = "Dimava" then
MsgBox "Name Validated"
Else
MsgBox "Incorrect Name"
End if
NXSupport - Your one-stop source for computer help
-
Sep 15th, 2000, 01:52 AM
#3
Junior Member
hi, kruks,
I think U need InStr instruction. It lets U find one string in another one.
Example:
dim s as string
dim sFirst as string
dim sLast as String
dim iAge as integer
dim iPos as integer
s="first_name*last_name*age"
'I look for first name
iPos = InStr(1,s,"*")
sFirst = left(s, iPos-1)
s = right(s,len(s)-iPos)
'I look for last name
iPos = InStr(1,s,"*")
sLast = left(s, iPos-1)
s = right(s,len(s)-iPos)
'I look for the age
iAge=Val(s)
Hope it'll help
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
|