• Welcome to Valhalla Legends Archive.
 

[SOLVED] VB.Net Split

Started by Zer0, October 14, 2006, 08:43 AM

Previous topic - Next topic

Zer0


   Function enter_user_info(ByVal selected As String)
        Dim a() As String
        Dim linein As String = selected
        a = linein.Split(";")
        addUserName.Text = a(0)
        addUserLevel.Text = a(1)
        Return True
    End Function


ok i have bee driving myself crazy all night over this, i finalyl got split to return A value. It is only returning one. The value of selected is
Bla4;100

the error it spits at me is
Index was outside the bounds of the array.
as if there isnt 2 values in the array. when obviusley there is.... or should be

MyndFyre

Set a breakpoint at the line "addUserName.Text = a(0)".  What's the value of a?
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Zer0

#2
a SHOULD be
Bla4;100
split at ";"

so a(0) should be
Bla4
and a(1) should be
100

a(0) is set correctly, but a(1) is empty

--edit:
ok im not sure what i did but i got it to split correctly on load, but now when i try and delte a row (this is a listbox) it throws that same error at me the code im using to delete a row is

    Function remove_user()
        If userIndex.Text <> Nothing Then
            userDb.Items.RemoveAt(userIndex.Text)
            Return "User [ " + addUserName.Text + " ] removed from database."
        Else
            Return "User was not found in the database."
        End If
    End Function


soo ne ideas on this one :p

---edit again

ok, i decided to look at this from a diffrent aproach on the delete part and got it working, i was tryong to splt info that wasnt there so now i got both parts working :)