How to get the 3rd character in a string

Well the title says it all

Let's say i have the string: "abcdefg"
i want to get the 3rd character (ie: "c") what is the function to do so?

This shouln't be too difficult to do
i know in excel the STXT function does it

TIAFYT (thanks in advance for your time)

Luthar
lutharAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lutharAuthor Commented:
Edited text of question.
0
schworakCommented:
Use the MID function

MID(String,Start,Len)



MID("abcdefg",3,1) returns "c"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lutharAuthor Commented:
Good comment but here's my code:
Option explicit
Dim Nbr_de_coup as integer

Private Sub Form_load()
Genere_La_Solution (Nbr_de_coup)
End sub
----------------------------------
Public Function Genere_La_Solution(ByVal Nbr_de_Case)

Dim x As Integer
Dim Nbr_Genere As String


    For x = 0 To Nbr_de_Case
        Let Nbr_Genere = Int(Rnd() * 5)
        Solution = Solution & Nbr_Genere
    Next x
   
End Function
------------------------------------
Public Sub Label1_Click(Index As Integer)
Dim i As Integer

Nbr_de_coup = Nbr_de_coup + 1

For i = 1 To Len(Solution)
Reponse = Mid(Solution, i, 1)
If Reponse <> Index Then
    MsgBox "Vous avez pousser une mauvaise touche!", vbOKOnly, "Que c'est dommage!"
    Exit Sub
End If
Next i
-----------------------------------

I get an error at the If Response <>...

Any suggestion?
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

mark2150Commented:
RESPONSE is a STRING, INDEX is an INTEGER. You can't compare an Integer to a String and get meaningful results...

M
0
Erick37Commented:
Is this what you are trying to do?
'...
i = InStr(1, solution, Format(Index))
If i <> Index Then
    MsgBox "Vous avez pousser une mauvaise touche!", vbOKOnly, "Que c'est dommage!"
    Exit Sub
End If
'...
0
lutharAuthor Commented:
Sounds more like it but the only problem is that I need the result to be different than 0 or 1 cause i have 5 label in the control array...
I'm gonna put more points cause i think it's worth more :D
0
matthewmayerCommented:
To convert a integer to a string use STR$(num). To convert from a string to a number use VAL("string").
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.