Visual Basic question (@)

Nevermind

Sub Email()
Mailadres = Text3.Text
at = InStr(Mailadres, "@")
If at = 0 Or at > 20 Then
MsgBox ("U voerde geen geldig emailadres in")
Else
nummer
End Sub


nevermind, found it
 
...

I i write:

John

in an inputfield, I want to be sure that the first letter is an uppercase one

john is not good, should be John,

Anyone knows how to code this ?

It has something todo with asci i think, i'm searching in some books @ the moment how this can be done
 
I know you can change all the text to upper or lower case but I don't know if you can do just the first. Look for the Ucase and Lcase functions.

Looking for the @ you can do several different ways. I would get the length of the string. Then loop that number of times doing a string compair looking for the @. When it is found load the loop var (i) into another variable. Then you know the position of @ in the string.

You could do the same thing with ascii. Each character has an ascii number. You could use this to do the compair in the loop. I think its Char(13) bype format. Char(13) is for a return. I use this alot when I want to put text on two lines but only use one label.
 
Last edited:
cd

Sub Naam()
nam = Text1.Text
Nletter = Mid(name, 1, 1)
Text4.Text = Nletter
End Sub

I had this in mind, but Nletter is not the first letter that I gave in text1.text.

If i can reach the first letter, I could convert it to asci and do like you say

CharlesM said:
I know you can change all the text to upper or lower case but I don't know if you can do just the first. Look for the Ucase and Lcase functions.

Looking for the @ you can do several different ways. I would get the length of the string. Then loop that number of times doing a string compair looking for the @. When it is found load the loop var (i) into another variable. Then you know the position of @ in the string.

You could do the same thing with ascii. Each character has an ascii number. You could use this to do the compair in the loop. I think its Char(13) bype format. Char(13) is for a return. I use this alot when I want to put text on two lines but only use one label.
 
...

Sub Naam()
nam = Text1.Text
Nletter = Mid(nam, 1, 1)
Text4.Text = Nletter
End Sub

]


this works now, made a mistake, but the code above works, now converting to ascii and i can compare

thanks
 
works

Sub Naam()
nam = Text1.Text
Nletter = Mid(nam, 1, 1)
ascinam = Asc(Nletter)
If ascinam < 65 Or ascinam > 90 Then
MsgBox ("De ingevoerde naam moet beginnen met een hoofdletter !!")
Else
voornaam
End If
End Sub


this works
 
How about just converting the first letter to a capital if it isn't already? Instead of putting up the MsgBox...
 
a = left(nam,1)
if ucase(a) = a then goto IsUpperCase
' do something if lower case

IsUpperCase:
' please, no comments from the peanut gallery about using
' GoTo's. That was a stupid rule some stupid person invented
' and too many people took it seriously.
 

Similar Topics

What's the difference between a 'checkbox' and an 'option button' ? I know that only one optionbutton can be true in a form or you have to use...
Replies
3
Views
3,449
What I need to do is: I need to calculate something like this: 1,2,3,5,8,13,21,... until 20 numbers. the third is the result of first +...
Replies
16
Views
6,707
Dear experts, I am want to program RS view32 with help of Microsoft visual basic (visual basic editor). But how to start I don't know,please...
Replies
10
Views
2,376
help How do I create Bidirectional Activex Connection Arrows? As per attached photo. How to Create RightoLeft Property in Visual Basic - Activex?
Replies
3
Views
1,655
I'm just trying to load from a text file into a string. I don't get why this doesn't work. Function LoadFile(FileName As String) As String()...
Replies
0
Views
1,548
Back
Top Bottom