Results 1 to 9 of 9

Thread: [RESOLVED] Help me please... PLEASE!

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2010
    Location
    United States
    Posts
    29

    Resolved [RESOLVED] Help me please... PLEASE!

    Ok, so i am trying to make a program that holds info in the settings... it holds it in an array so that you can add to it and take away from it... he is the code i have so far....

    So far it is just the adding part but im still haveing some problems... help me please!


    Code:
    Public Class Form1
        
        Public Function array_use1(ByVal array_string As String, ByVal number As Integer)
            Dim num_holder As Integer = number
            Dim num_holder2 As Integer = number
            Dim users_string As String = array_string
            Dim run(num_holder) As String
            If users_string = "" Then
                Return (run)
            Else
                Dim holder As Integer = 0
                Dim numbre As String = ""
                Do Until num_holder = 0
                    If Not holder = users_string.Length + 1 Then
                        Dim a As String = users_string.Chars(holder)
                        If a = "," Then
                            If Not numbre = "" Then
                                run(num_holder) = numbre
                                numbre = ""
                                a = ""
                                num_holder -= 1
                            End If
                        Else
                            numbre = numbre & a
                        End If
                    Else
    
                    End If
                    holder += 1
                Loop
                Return (run)
            End If
        End Function
    
    
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            Dim new1 As String = TextBox2.Text
            Dim intloop As Integer = My.Settings.Number
            Dim j As String = ""
            If Not intloop = 0 Then
                Do Until intloop = 0
                    j = j & array_use1(My.Settings.Users, My.Settings.Number)(intloop) & ","
                    intloop -= 1
                Loop
                j = j & new1
                My.Settings.Users = j
                Dim h As Integer = My.Settings.Number
                Dim i As Integer = h + 1
                My.Settings.Number = i
            Else
                My.Settings.Users = TextBox2.Text & ","
                My.Settings.Number = 1
            End If
    
    
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            TextBox1.Text = ""
            Dim l As Integer = My.Settings.Number
            If Not l = 0 Then
                Do Until l = 0
                    TextBox1.Text = TextBox1.Text & vbNewLine & array_use1(My.Settings.Users, My.Settings.Number)(l)
                    l -= 1
                Loop
            End If
        End Sub
    
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            My.Settings.Number = 0
            My.Settings.Users = ""
        End Sub
    End Class
    i keep getting an error in the function at this line:
    Code:
    Dim a As String = users_string.Chars(holder)
    This is the error:



    Please help... im trying to get this done so i can demonstrate how it works to some friends. Thankyou for ANY help.

    And also note that i dont want you to like write out a bunch of code then tell me its the right way... i would REALLY like it explained... but either works... thanks.
    Last edited by thefiscster; Mar 24th, 2011 at 12:22 PM. Reason: Adding the error image

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width