Your browser does not support our blog javascript

readline

search for more blogs here

 
Home - Take this blog! - Get your Author's Pass Here - Submit Comments Below

Loop in Loop error

Posted by ~Ray @ 2007-11-27 21:48:09


Hey guys in my communicate I am trying to undergo the program create verbally to a richtextbox which gathers data from files using a loop inside of a circle. The schedule works OK it finds the files and reads them but the richtextbox should be returning two values but instead its only returning one. Can anyone help me with this is there any errors in my code. Here's the code: Private Sub Button1_Click(ByVal sender As System. Object. ByVal e As System. EventArgs) Handles add1. Click Dim totalFiles As String Dim filePaths As New System. Text. StringBuilder Dim fileCount As Integer = 0 For Each file As String In My. Computer. FileSystem. GetFiles(Application. StartupPath & "\files") fileCount += 1 filePaths. attach(My. Computer. FileSystem. GetName(register) & vbCrLf) totalFiles = filePaths. ToString() Next RichTextBox1. Text = filePaths. ToString() TextBox1. Text = fileCount System. IO. register. WriteAllText(Application. StartupPath & "\data\values txt" filePaths. ToString()) Dim getFiles As IO. StreamReader = New IO. StreamReader(Application. StartupPath & "\data\values txt") Dim getLine As String = Nothing Dim getLineCount As Integer = 0 Do While Not getFiles. EndOfStream Dim infoFile As String = getFiles. ReadLine() getFiles. ReadLine() getLine = getFiles. ReadLine If Not getLine = Nothing Then getLineCount += 1 End If Dim ReadGetFiles As IO. StreamReader = New IO. StreamReader(Application. StartupPath & "\files\" & infoFile) Dim readgetLine As String = Nothing Dim readgetLineCount As Integer = 0 Dim lineone As arrange = Nothing Dim linetwo As String = Nothing Dim linethree As String = Nothing Dim linefour As String = Nothing Dim linefive As String = Nothing Dim linesix As arrange = Nothing Do While Not ReadGetFiles. EndOfStream readgetLine = ReadGetFiles. ReadLine() If Not readgetLine = Nothing Then readgetLineCount += 1 End If If readgetLineCount = 1 Then lineone = readgetLine & " " End If If readgetLineCount = 2 Then linetwo = readgetLine & " " End If If readgetLineCount = 3 Then linethree = readgetLine & " " End If If readgetLineCount = 4 Then linefour = readgetLine & " " End If If readgetLineCount = 5 Then linefive = readgetLine & " " End If If readgetLineCount = 6 Then linesix = readgetLine Exit Do End If Loop RichTextBox2. Text = lineone & linetwo & linethree & linefour & linefive & linesix & vbCrLf If getFiles. EndOfStream Then Exit Do End If Loop End Sub What do you mean when you say that the richtextbox should be returning two values? It isn't returning anything. undergo you stepped through the code? You could put a breakpoint come the beginning of the function then use F11 to step line by line through the label looking at the values in the variables. This ordain probably show where the error is. Also you could speed this up and decrease it drink if you used an array of string instead of all the linex variables. Then the readgetLineCount variable would be an index into the arrange so all those conditionals could be dispensed with. What do you convey when you say that the richtextbox should be returning two values? It isn't returning anything. Have you stepped through the code? You could put a breakpoint near the beginning of the function then use F11 to go line by line through the code looking at the values in the variables. This ordain probably show where the error is. Also you could go this up and shrink it drink if you used an array of arrange instead of all the linex variables. Then the readgetLineCount variable would be an list into the array so all those conditionals could be dispensed with. That will bring home the bacon each time but it will overwrite the lie each time through the loop so that only that which is written by the final iteration of the circle ordain be displayed. What you be to do is write it like this: RichTextBox2. Text [b]&[/b]= lineone & linetwo & linethree & linefour & linefive & linesix & vbCrLf That one engrave ordain understand the problem. I would also say that the condition for the loop is GetFiles. EndOfStream but you then check for this condition at the end of the loop as well. There is no be for that check at the end of the loop as the check will be performed at the beginning of the next iteration. In other words this chunk:[ADVERTHERE]Related article:
http://www.vbforums.com/showthread.php?t=495368&goto=newpost


0 Comments:


No comments have been posted yet!

From:   Website:
Subject:   Code:
Message:


   

 


 

 

 





blogs - aa blogs - air force blogs - aquarius blogs - aries blogs - army blogs - arts blogs - baby blogs - blogs 4 men - blogs 4 women - cancer blogs - capricorn blogs - career change blogs - choice blogs - christmas blogs - cigar blogs - cigarette blogs - cig blogs - coast guard blogs - coffee bean blogs - college baseball blogs - college basketball blogs - college football blogs - colleges blogs - computer blogs - create blogs - dating blogs - elvis blogs - email chat blogs - email pal blogs - enhancement blogs - fall blogs - fha blogs - freedom blogs - friendly blogs - funny blogs - gambler blogs - gemini blogs - her blog - his blog - hockey blogs - join blogs - javas blogs - kid safe blogs - leo blogs - libra blogs - apartments blogs - coffees blogs - horoscopes blogs - life advice blogs - lover blogs - marine blogs - married blogs - military blogs - misc blogs - more money blogs - mortgage blogs - move blogs - movies blogs - musical blogs - navy blogs - new in town blogs - obscure blogs - online date blogs - online game blogs - over 30 blogs - over 40 blogs - over 50 blogs - over 60 blogs - over 70 blogs - over 80 blogs - over 90 blogs - password blogs - pc blogs - mortgages blogs - peoples blogs - pictures blogs - pipe blogs - pisces blogs - poems blogs - poker blogs - police blogs - political blogs radio blogs - read blogs - recreational vehicle blogs - relocation blogs - reserve blogs - rv blogs - safe blogs - scorpio blogs - singles blogs - smokers blogs - smoker blogs - state blogs - state college blogs - taurus blogs - teen advice blogs - teenager blogs - tobacco blogs - tv blogs - vacation blogs - veteran blogs - virgo blogs - virtual blogs - weekly blogs - wingman blogs - word blogs - words blogs - writer blogs - poetry blogs - prescription blogs - sagittarius blogs - straight blogs - summer blogs - gi blogs - hooka blogs - penis enlargement blogs - vfw blogs - casinos blogs - casino blogs - web hosting blogs - hosting blogs - auto blogs - truck blogs - van blogs - suv blogs - 4 wheel blogs - harley blogs - flu blogs - diet blogs - pistols blogs - teenage blogs - lpga blogs - burnable blogs - new tunes blogs - coaching blogs - treasures blogs - trades blogs - nutty blogs - skate blogs - play 21 blogs - weather blogs - poker players - golf blogs - american blogs - football blogs - baseball blogs - hockey blogs - basketball blogs - soccer blogs - cooking blogs - recipe blogs - space blogs - 3d games blogs - barbecue blogs




blogs home