ARRAY count

I have n array variable set to 100. I have filled it with about 45 entries. What I am looking for a bit of code that will let me how many fields I have inputed. I am using streamreader to bring the file in and I want a count of how many entries I have inputed.

Comments

  • : I have n array variable set to 100. I have filled it with about 45 entries. What I am looking for a bit of code that will let me how many fields I have inputed. I am using streamreader to bring the file in and I want a count of how many entries I have inputed.

    1) Have a counter that "clicks" every time you add something to the array.

    2) Make sure the array has some kind of weird-value on every position from the beginning. Then, when you're done, go and look for the first occurence of that weirdo.



    Kind Regards
    Konrad
    ----------------------------
    (+46/0) 708-70 73 92
    chamster@home.se
    http://konrads.webbsida.com

  • Dim filesadded as byte = 0
    Public Sub loadusersvariables(byref filesadded as byte)
    Dim fs As FileStream = New FileStream("users /" & username, _ & "/ variables.dat", FileMode.OpenOrCreate)
    Dim w As BinaryReader = New BinaryReader(fs)
    Dim objcts As Integer, helpers As Integer
    filesadded = 0
    For x = 0 To 100
    user(x) = w.ReadInt32() & ControlChars.CrLf
    filesadded += 1
    Next
    w.Close()
    End Sub

    'Declare filesadded as global send it to the sub as I have done here... let me know if this works for ya ok? This I changed values but have used to load variables for my application from a saved .dat file. This should be sufficient. Just change binaryreader to streamreader howver needed. If you have more questions email me at KeeblerShadowHaje@yahoo.com (leave nice subject i might mistake for junk mail :)) This will send the sub variable filesadded byref and then make that variable = 0, start the array input loop and then end the sub returning hte number of variable entered into the array user(x). Try changing around and use this for your files. p.s.(this example is meant to input integer values into an array from a single file, if this is not on the same line as what your looking for then e-mail me small example to the best you have and I will return the code in the best working way I can think of with explanation, please let me know if this helps, if not sorry...)

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories