I have a string 17:55:88

I want to split this up into the three sections and store them in varibles.
IE I would like to have the 88 stored in a varible the 55 in a varible and the 17 in a varible.

the following code does what i want, but i dont know how to put the results into their own varibles.
if someone could help thats would be most helpfull

     Dim words As String() = _INTime.Split(New Char() {":"c})

        ' Use For Each loop over words and display them
        Dim word As String
        For Each word In words
            MsgBox(word)
        Next

or if you can think of a better way to split this string please let me know.

Recommended Answers

I don't understand. You don't know how to use an array?

Dim First, Second, Third as string

if words.GetLength(0) = 3 then

    First = words(0)
    Second = words(1)
    Third = words(2)

end if

ps

How did your HideSplashScreen situation go?

Jump to Post

All 2 Replies

Member Avatar

I don't understand. You don't know how to use an array?

Dim First, Second, Third as string

if words.GetLength(0) = 3 then

    First = words(0)
    Second = words(1)
    Third = words(2)

end if

ps

How did your HideSplashScreen situation go?

commented: Sorry your right i dont know how to use and array, i am a new to programming thanks for youe help. As for the Hide splahscreen this is now working thanks again for your help and paitence. +2
Dim tokens() As String = "17:55:88".Split(":")

This will give you an array with indices from 0 to 2 where

tokens(0) = "17"
tokens(1) = "55"
tokens(2) = "88"
commented: thanks for your help Jim much a +2
Be a part of the DaniWeb community

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