VB.Net Help

Discussion in 'Software' started by RobWing, Jun 23, 2004.

  1. RobWing

    RobWing Private E-2

    How can I output IntIdNum for every integer in the freq array? Right now when I output to lstArrayData.Items, IntIdNum it is just equal to the random value for the last time it was in the for loop, but I want all the values from intNumVisitIndex = 0 To CInt(txtNumVisit.Text) not just the lastone. How would i change my output line to do this?

    For intNumVisitIndex = 0 To Freq.GetUpperBound(0)
    lstArrayData.Items.Add(intIdNum & " " & Freq(intNumVisitIndex))

    Thanks
    Robert

    Dim intNumVisitIndex As Integer
    Dim intIdNum As Integer
    Dim Rand As New Random
    Dim Freq(4999) As Integer


    For intNumVisitIndex = 0 To CInt(txtNumVisit.Text)
    IntIdNum = Rand.Next(20001, 25001)
    Freq(intIdNum - 20001) += 1

    Next

    lstArrayData.Items.Clear()

    For intNumVisitIndex = 0 To Freq.GetUpperBound(0)
    lstArrayData.Items.Add(intIdNum & " " & Freq(intNumVisitIndex))
    Next
     
  2. Kodo

    Kodo SNATCHSQUATCH

    your problem lies here

    For intNumVisitIndex = 0 To CInt(txtNumVisit.Text)
    IntIdNum = Rand.Next(20001, 25001)
    Freq(intIdNum - 20001) += 1

    Next


    every time you loop through you are setting IntldNum to the a new value. What you need to do is concatenate the values to a new variable and then split them outside the loop to create a new array.
     
  3. RobWing

    RobWing Private E-2

    Hey thanks.....it turned out all i needed to do was to just add 2100 to the index for my output, but I am sure your hint will come hanndy in the furtue.

    Robert
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds