Jump to content

Loops

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
D00M

D00M

    Newbie

  • Members
  • PipPip
  • 18 posts
Guys m want to make a code that loops on every item in list box(items will b loaded from text file)so number of items will vary for every user

2.and 2nd list box contains the raw data(that was loaded from txt file) and processed data in following form


RAW DATA: PROCESSED DATA
RAW DATA: PROCESSED DATA
RAW DATA: PROCESSED DATA


as there may b many items so how to get loop my code for each line it works fine for one line and add data like i mentioned above

Edited by D00M, 22 May 2010 - 01:29 PM.
emoticon showed :P


#2
so1i

so1i

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 312 posts
Not quite sure what you mean. Could you post the code you have already?
My Company - My Homepage - My Twitter - My Google+ - My LinkedIn

"Things don’t have to change the world to be important.” - Steve Jobs

#3
Staeonz

Staeonz

    Newbie

  • Members
  • Pip
  • 2 posts
I'm currently seeing loops in programming classes, so I might be able to help you.
Problem is, I don't really understand what you mean either.

#4
Ray Tawil

Ray Tawil

    Programmer

  • Members
  • PipPipPipPip
  • 108 posts
check this video tutorial about loops in c# its almost the same in vb.net, might help you:


Share your Knowledge, It's one way to achieve immortality.
Video Tutorial Channel

#5
Jody LeCompte

Jody LeCompte

    Newbie

  • Members
  • PipPip
  • 18 posts
You can use the StreamWriter.Peek(system.io.streamwriter) method to load the files into the first list box. Peek() will return -1 if the next line to be read is EOF. This could be coupled with a do until loop to fill your first listbox with the "raw" data.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Form1.Load
        Dim objStreamReader As System.IO.StreamReader
        Dim strLineRead As String
        objStreamReader = IO.File.OpenText("path")
        Do Until objStreamReader.Peek() = -1
            strLineRead = objStreamReader.ReadLine()
            ListBox1.Items.Add(strLineRead)
        Loop
    End Sub

As for as everything else in your post, I can't really advise any more than anyone else without you elaborating first.