Visual Basic, .NET, ASP, VBScript
 

   
   
     

Форум - .NET

Страница:

 

  Вопрос: VB .NET (Оптимизация, бесконечно вложенный цикл) Добавлено: 16.12.12 21:06  

Автор вопроса:  Артем
Есть код в нем куча вложенных циклов, надо это дело оптимизировать.

Кусок кода без оптимизации:
                            For i6 = 1 To str.Length
                                strn = Mid(str, i1, 1)
                                strn = strn & Mid(str, i2, 1)
                                strn = strn & Mid(str, i3, 1)
                                strn = strn & Mid(str, i4, 1)
                                strn = strn & Mid(str, i5, 1)
                                strn = strn & Mid(str, i6, 1)
                                ListBox1.Items.Add(strn)
                                updateform()
                                If str.Length = 6 Then GoTo nextstr6

                                For i7 = 1 To str.Length
                                    strn = Mid(str, i1, 1)
                                    strn = strn & Mid(str, i2, 1)
                                    strn = strn & Mid(str, i3, 1)
                                    strn = strn & Mid(str, i4, 1)
                                    strn = strn & Mid(str, i5, 1)
                                    strn = strn & Mid(str, i6, 1)
                                    strn = strn & Mid(str, i7, 1)
                                    ListBox1.Items.Add(strn)
                                    updateform()
                                    If str.Length = 6 Then GoTo nextstr7

                                    For i8 = 1 To str.Length
strn = Mid(str, i1, 1)
strn = strn & Mid(str, i2, 1)
strn = strn & Mid(str, i3, 1)
strn = strn & Mid(str, i4, 1)
                                        strn = strn & Mid(str, i5, 1)
                                        strn = strn & Mid(str, i6, 1)
                                        strn = strn & Mid(str, i7, 1)
                                        strn = strn & Mid(str, i8, 1)
                                        ListBox1.Items.Add(strn)
                                        updateform()

                                    Next
nextstr7:

                                Next
nextstr6:
                            Next


Спасибо.

Ответить

  Ответы Всего ответов: 0  

Нет ответов

Страница:

Поиск по форуму



© Copyright 2002-2011 VBNet.RU | Пишите нам