I have removed all the 'console.writeline' commands from the for..next loop.
The program loads a text file of any size which in this case contains about 5000 lines. It itterates through them looking for specific information.
This can take two or three minutes at the absolute minimum. Is there a reason for this? Or is it just very much slower when in debug mode?
Or, as I am new to VB, have I missed something fairly fundemental?
Code:If RB2_time.Checked = False Then ' parsing an npc - all damage against this npc If ComboB2_all_combatants.SelectedItem.ToString.Contains(" ") = True Then Console.WriteLine(RTB_Selected_File.Lines.GetUpperBound(0)) length_text_file = RTB_Selected_File.Lines.GetUpperBound(0) For count1 = 0 To length_text_file current_line = RTB_Selected_File.Lines(count1) If (current_line.Contains(ComboB2_all_combatants.SelectedItem.ToString) = True) And (RTB_Selected_File.Lines(count1).Contains(non_melee) = True Or RTB_Selected_File.Lines(count1).Contains(melee_hit)) Then 'Console.WriteLine("test " + count1.ToString + " " + RTB_Selected_File.Lines(count1).ToString) If current_line.EndsWith(".") = True Or current_line.EndsWith("!") = True Then current_line = current_line.Remove(current_line.Length - 1, 1) End If current_line = current_line.Remove(0, 27) ' ****************************** For count2 = 0 To ComboB2_all_combatants.Items.Count - 1 ' The code checks that the line of text has both combatants. This is done by ensuring that they are not the same name. If current_line.StartsWith(display_name_Array(count2)) And display_name_Array(count2).ToString <> ComboB2_all_combatants.SelectedItem.ToString Then total_damage = 0 count3 = current_line.LastIndexOf("for") total_damage = Val(total_damage_Array(count2)) + Val(Mid(current_line, count3 + 4, 6)) total_damage_Array(count2) = total_damage ' The code around here checks previous line to see if it was a critical attack ' previous_line critical_hit critical_blast critical_undead ElseIf current_line.StartsWith(ComboB2_all_combatants.SelectedItem.ToString) And current_line.Contains(display_name_Array(count2)) = True And display_name_Array(count2).ToString <> ComboB2_all_combatants.SelectedItem.ToString Then total_damage = 0 End If Next ' ****************************** 'count2 = 0 'Do While attack_melee_casterArray(count2) <> "" ' If current_line.Contains(attack_melee_casterArray(count2)) = True Then ' ' updates specific attack type ' End If ' count2 += 1 'Loop Else End If Next ' =================================================================== ' adds the data to the display grid, names, damage, duration, dps etc Data_ParseTable.Rows.Clear() For count1 = 0 To total_damage_Array.GetUpperBound(0) If display_name_Array(count1) <> "" Then Data_ParseTable.Rows.Add(display_name_Array(count1), Val(total_damage_Array(count1))) End If Next Else ' parse a Player's toon- this is known because there is at least one space in the name. Console.WriteLine("Parsing a player's toon") End If Else ' parse from time to time End If




Reply With Quote