I done my logincontrol project in c# using asp.net2.0. it is accepting spaces in username textbox which i don't want.It should not accept any spaces before entering text.please give solution.

Recommended Answers

All 4 Replies

i have some VB.NET code that searches and removes spaces froma string if thats any use to you

ya will do..send me vb.net solution

grr need to install vb again wait a minute

i seem to have lost the .NET code but this may be of help - here is some VB6 code that gets you to enter your name and then spilits it

e.g if you inout "James Bennet" it says:

Firstname = James
Lastname = Bennet

Private Sub Command1_Click()
 
Dim length As Integer
 
Dim name As String
Dim Firstname As String
Dim LastName As String
 
Dim x As Integer
 
    name = InputBox("What is your name")
 
length = Len(name)
 
x = InStr(name, " ")
 
Firstname = Left(name, x)
LastName = Right(name, length - x)
 
    MsgBox "The first is " & Firstname
    MsgBox "The last name is " & LastName
 
End Sub

you could use something like this on your password program to discard anything after the space

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.