Как исправить ошибку list index out of bounds 1

by Milan Stanojevic

Milan has been enthusiastic about technology ever since his childhood days, and this led him to take interest in all PC-related technologies. He’s a PC enthusiast and he… read more


Updated on November 16, 2021

  • The List index out of bounds error can appear when trying to run certain applications on your PC.
  • To quickly solve it, feel free to remove System Mechanic files and check your current antivirus.
  • Head on to our Troubleshooting Boot Errors section too and you won’t walk away disappointed.
  • Don’t waste your time and visit our Windows 10 Errors Hub for plenty of other useful solutions.

XINSTALL BY CLICKING THE DOWNLOAD FILE

To fix various PC problems, we recommend Restoro PC Repair Tool:
This software will repair common computer errors, protect you from file loss, malware, hardware failure and optimize your PC for maximum performance. Fix PC issues and remove viruses now in 3 easy steps:

  1. Download Restoro PC Repair Tool that comes with Patented Technologies (patent available here).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues affecting your computer’s security and performance
  • Restoro has been downloaded by 0 readers this month.

List index out of bounds error will prevent you from running your favorite applications, so today we’re going to show you how to fix this error on Windows 10.

Well, it can appear in almost any application, and speaking of this error, here are some common problems that users reported:

  • List index out of bounds (0), (-1), 1, (2), (3) – This issue can appear due to your antivirus, and if you encounter it, disable or uninstall your antivirus and check if that helps.
  • Game maker, GTA V, Resident Evil 6 error list index out of bounds – Sometimes this problem can appear with certain applications or games. If this happens, reinstall the application that is giving you this error and check if that helps.
  • Runtime error list index out of bounds – This problem can sometimes appear because the application you’re trying to run isn’t fully compatible with Windows 10. To fix that, just run the application in Compatibility mode and check if that helps.
  • List index out of bounds 1 Realtek HD Audio Manager – As we already mentioned, this issue can affect almost any application, and if you’re having this issue, update the affected application to the latest version and check if that helps.

How can I fix the List index out of bounds error?

  1. Remove System Mechanic files
  2. Delete the temporary files
  3. Check your antivirus
  4. Try running the application in Compatibility mode
  5. Update the application to the latest version
  6. Rename the Skype directory
  7. Reinstall the problematic application
  8. Perform a clean boot

1. Remove System Mechanic files

  1. Open File Explorer and go to C:ProgramDataiolo This directory is by default hidden, so you’ll need to reveal it. Simply go to the C: drive and then choose View and check Hidden items.
    List index out of bounds 1
  2. Once you enter this directory, look for Smgthints.xml and Status.xml files and remove them.

According to users, List index out of bounds error can appear when trying to run System Mechanic.

It seems that this error is caused by certain System Mechanic files that can become corrupted, so to fix this problem you need to find and remove those files from your PC.

After removing these files, check if the problem is still there.

Keep in mind that this solution only works for System Mechanic software, so if another application is giving you this problem, you’ll have to use a different solution.

2. Delete the temporary files

  1. Press Windows Key + R keyboard shortcut and enter %temp%. Press Enter or click OK.
    Resident Evil 6 error list index out of bounds
  2. Select all files and delete them.
  3. Now press Windows Key + R again and type TEMP. Press Enter or click OK.
    Runtime error list index out of bounds
  4. Select all files and delete them.

According to users, List index out of bounds error can appear due to your temporary files. Many applications create temporary files, and these files can sometimes cause various problems.

To fix this and many other problems, it’s highly advised to remove all temporary files. To do that, just follow the above steps.

After doing that, check if the problem is resolved. If you want, you can also use Disk Cleanup to clean the temporary files and fix this problem.

If you want an advanced tool that will clean temporary files along with old and unnecessary files, we suggest that you try dedicated registry cleaner tools.

3. Check your antivirus

If you’re getting List index out of bounds error on your PC, the problem might be your antivirus software. Sometimes your antivirus can block certain files and that will prevent applications from running properly.

To check if your antivirus is the problem, you need to disable certain antivirus features or even disable your antivirus altogether. If that doesn’t help, you might even have to remove your third-party antivirus.

This is perfectly safe to do on Windows 10 since Windows Defender will still protect your system, even if you remove your antivirus.

Once you remove your antivirus, check if the problem is still there. If removing the antivirus solves the problem, you should consider switching to a different antivirus solution.

At the same time, if you need a strong alternative you should choose from the best antivirus solutions for Windows 10 to remove the error once for all.

4. Try running the application in Compatibility mode

  1. Right-click the application that is giving you this message and choose Properties from the menu.
    Game maker error list index out of bounds
  2. Go to the Compatibility tab and check Run this program in compatibility mode for option. Now select an older version of Windows. Click Apply and OK to save changes.
    List index out of bounds (0)

List index out of bounds error can sometimes appear if the application you’re trying to run isn’t fully compatible with Windows 10.

This can happen with older applications, but you might be able to fix the problem simply by running it in Compatibility mode.

In case you don’t know, Compatibility mode is a special feature that allows you to run old applications on Windows 10, and you can activate Compatibility Mode by doing as described above.

According to users, using the Compatibility mode might fix this problem for you, but you might have to experiment with different settings until you find the one that works for you.

5. Update the application to the latest version

Some PC issues are hard to tackle, especially when it comes to corrupted repositories or missing Windows files. If you are having troubles fixing an error, your system may be partially broken.
We recommend installing Restoro, a tool that will scan your machine and identify what the fault is.
Click here to download and start repairing.

If you’re getting List index out of bounds error perhaps the application you’re trying to run is the problem. Certain applications can give you this error if they encounter any bugs or glitches.

The best way to avoid glitches is to keep the application up to date. If you encounter this problem, try to download the latest version of the application and install the latest updates.

After the updates are installed, check if the problem is still there.

6. Rename the Skype directory

  1. Close Skype completely on your PC.
  2. Press Windows Key + R. Now enter %appdata% and press Enter or click OK.
    List index out of bounds 1 Realtek HD Audio Manager
  3. Locate the Skype directory and change its name to skype.old.
    List index out of bounds (2)
  4. After doing that, start Skype again and check if the issue is still there.

Many users reported List index out of bounds error while trying to run Skype.

This error can occur if your files are corrupted, but you might be able to fix the problem by renaming your Skype directory.

This is a simple solution, but keep in mind that it only works with Skype. If you have this problem with any other application, you might want to try using a different solution.

7. Reinstall the problematic application

According to users, sometimes the only way to fix this problem is to reinstall the problematic application. List index out of bounds error can appear in almost any application, and sometimes the only way to fix this problem is to uninstall it.

In case you don’t know, a desirable method is to find a dedicated program like an efficient uninstaller software for your Windows 10 PC. That way, you can safely reinstall the affected application and thus resolve this kind of error.

You should know that such programs can also remove any file and registry entries associated with it from your PC.

Once you remove the application, install the latest version again and the problem should be permanently resolved.

8. Perform a clean boot

  1. Press Windows Key + R. Type msconfig and click OK or press Enter.
    Runtime error list index out of bounds
  2. The System Configuration window will now appear. Navigate to the Services tab and check Hide all Microsoft services option. Now click the Disable all button.
    GTA V error list index out of bounds
  3. Now head over to the Startup tab and click Open Task Manager.
    List index out of bounds (-1)
  4. When Task Manager opens, you’ll see a list of startup applications. Right-click the first application on the list and choose Disable from the menu. Repeat this for all startup applications.
    List index out of bounds 1 Realtek HD Audio Manager
  5. Once you disable all startup applications, you need to go back to the System Configuration window. Click Apply and OK to save changes and restart your PC.
    Runtime error list index out of bounds

If you keep getting List index out of bounds error, the problem might be a third-party application on your PC.

To find the problematic application, it’s advised that you perform a clean boot and disable all startup applications and services.

You can do that by following the above steps.

Once your PC restarts, check if the problem is still there. If the issue doesn’t appear, it means that one of the startup applications or services was causing it.

To pinpoint the cause, it’s advised to enable applications and services one by one or in groups until you find the cause of the problem.

Once you find it, remove the problematic application and the issue should be permanently resolved.

As you can see List index out-of-bounds error can be quite problematic and prevent you from running your favorite application.

However, you should be able to fix this problem simply by reinstalling the problematic application or by updating it.

If that doesn’t work, feel free to try any other solution from this article.

newsletter icon

При попытке запуска определенных приложений на вашем компьютере может появиться ошибка «Список за пределами списка». Эта ошибка не позволит вам запускать ваши любимые приложения, поэтому сегодня мы собираемся показать вам, как исправить эту ошибку в Windows 10.

Ошибка индекса списка вне границ может появиться практически в любом приложении, и, говоря об этой ошибке, вот некоторые распространенные проблемы, о которых сообщили пользователи:

  • Перечислите индекс за пределами (0), (-1), 1, (2), (3) — эта проблема может возникать из-за вашего антивируса, и, если вы столкнулись с ним, отключите или удалите антивирус и проверьте, помогает ли это.
  • Игровой производитель, GTA V, индекс списка ошибок Resident Evil 6 вне пределов — иногда эта проблема может возникать в определенных приложениях или играх. Если это произойдет, переустановите приложение, которое выдает эту ошибку, и проверьте, помогает ли это.
  • Индекс списка ошибок времени выполнения за пределами. Эта проблема может иногда появляться, потому что приложение, которое вы пытаетесь запустить, не полностью совместимо с Windows 10. Чтобы это исправить, просто запустите приложение в режиме совместимости и проверьте, помогает ли это.
  • Индекс списка за пределами 1 Realtek HD Audio Manager — Как мы уже упоминали, эта проблема может затронуть практически любое приложение, и, если у вас возникла эта проблема, обновите уязвимое приложение до последней версии и проверьте, помогает ли это.

Список индексов выходит за границы ошибки, как это исправить?

  1. Удалить файлы System Mechanic
  2. Проверьте свой антивирус
  3. Попробуйте запустить приложение в режиме совместимости
  4. Обновите приложение до последней версии
  5. Переименовать каталог Skype
  6. Переустановите проблемное приложение
  7. Удалить временные файлы
  8. Выполните Чистую загрузку

Решение 1 — Удалить файлы System Mechanic

По словам пользователей, при попытке запустить System Mechanic может появиться ошибка L ist index of bounds. Кажется, что эта ошибка вызвана некоторыми файлами System Mechanic, которые могут быть повреждены, поэтому для решения этой проблемы вам нужно найти и удалить эти файлы с вашего ПК.

Для этого просто выполните следующие действия:

  1. Откройте проводник и перейдите в каталог C: ProgramDataiolo. Этот каталог по умолчанию скрыт, поэтому вам нужно его раскрыть. Просто перейдите на диск C: и затем выберите View и проверьте Hidden items.

  2. Как только вы войдете в этот каталог, найдите файлы Smgthints.xml и Status.xml и удалите их.

После удаления этих файлов проверьте, сохраняется ли проблема. Имейте в виду, что это решение работает только для программного обеспечения System Mechanic, поэтому, если другая проблема дает вам эту проблему, вам придется использовать другое решение.

  • ЧИТАЙТЕ ТАКЖЕ: ИСПРАВЛЕНИЕ: Adobe Error 2060 не позволяет Skype работать

Решение 2 — Проверьте свой антивирус

Если вы получаете ошибку List index of bounds на вашем ПК, возможно, проблема в антивирусном программном обеспечении. Иногда ваш антивирус может блокировать определенные файлы, что препятствует нормальной работе приложений.

Чтобы проверить, является ли ваш антивирус проблемой, вам нужно отключить определенные антивирусные функции или даже вообще отключить антивирус. Если это не поможет, возможно, вам даже придется удалить сторонний антивирус. Это совершенно безопасно сделать в Windows 10, поскольку Защитник Windows по-прежнему будет защищать вашу систему, даже если вы удалите антивирус.

После того, как вы удалите антивирус, проверьте, сохраняется ли проблема. Если удаление антивируса решает проблему, вам следует подумать о переходе на другое антивирусное решение. Bitdefender предлагает отличную защиту и никак не повлияет на ваши приложения, поэтому, если вы ищете надежный антивирус, рекомендуем вам попробовать Bitdefender.

  • Получить сейчас Bitdefender

Решение 3. Попробуйте запустить приложение в режиме совместимости

Список индексов за пределами границ может иногда появляться, если приложение, которое вы пытаетесь запустить, не полностью совместимо с Windows 10. Это может случиться со старыми приложениями, но вы можете решить проблему, просто запустив его в режиме совместимости.,

Если вы не знаете, режим совместимости — это специальная функция, которая позволяет запускать старые приложения в Windows 10, и вы можете активировать режим совместимости, выполнив следующие действия:

  1. Щелкните правой кнопкой мыши приложение, которое отправляет вам это сообщение, и выберите « Свойства» в меню.

  2. Перейдите на вкладку « Совместимость » и установите флажок « Запустить эту программу в режиме совместимости». Теперь выберите более старую версию Windows. Нажмите Apply и OK, чтобы сохранить изменения.

По мнению пользователей, использование режима совместимости может решить эту проблему для вас, но вам, возможно, придется экспериментировать с другими настройками, пока не найдете тот, который подходит именно вам.

Решение 4. Обновите приложение до последней версии.

Если вы получаете ошибку List index of bounds, возможно, проблема в приложении, которое вы пытаетесь запустить. Некоторые приложения могут выдавать эту ошибку, если они сталкиваются с ошибками или сбоями. Лучший способ избежать сбоев — поддерживать приложение в актуальном состоянии.

Если вы столкнулись с этой проблемой, попробуйте загрузить последнюю версию приложения и установить последние обновления. После установки обновлений проверьте, сохраняется ли проблема.

Решение 5 — Переименуйте каталог Skype

Многие пользователи сообщали об ошибке List index of bounds при попытке запустить Skype. Эта ошибка может возникать, если ваши файлы повреждены, но вы можете исправить проблему, переименовав каталог Skype. Для этого просто выполните следующие действия:

  1. Закройте Skype полностью на вашем компьютере.
  2. Нажмите клавишу Windows + R. Теперь введите % appdata% и нажмите Enter или нажмите OK.

  3. Найдите каталог Skype и измените его имя на skype.old.

  4. После этого снова запустите Skype и проверьте, сохраняется ли проблема.

Это простое решение, но имейте в виду, что оно работает только со Skype. Если у вас есть эта проблема с любым другим приложением, вы можете попробовать использовать другое решение.

  • Читайте также: 4 решения для исправления ошибок Windows 10 0xc004e016 и 0xc004c003

Решение 6 — Переустановите проблемное приложение

По словам пользователей, иногда единственный способ решить эту проблему — переустановить проблемное приложение. Ошибка индекса списка вне границ может появиться практически в любом приложении, и иногда единственным способом решения этой проблемы является ее удаление.

Есть несколько способов сделать это, но наиболее эффективным является использование программного обеспечения для удаления, такого как Revo Uninstaller. В случае, если вы не знаете, программа удаления может удалить любое приложение с вашего ПК, но также удалит все файлы и записи реестра, связанные с ним.

  • Получить сейчас версию Revo Unistaller Pro

После удаления приложения установите последнюю версию еще раз, и проблема должна быть решена окончательно.

Решение 7 — Удалить временные файлы

По словам пользователей, из-за ваших временных файлов может появиться ошибка List index of bounds. Многие приложения создают временные файлы, и эти файлы могут иногда вызывать различные проблемы. Чтобы исправить эту и многие другие проблемы, настоятельно рекомендуется удалить все временные файлы. Для этого просто выполните следующие действия:

  1. Нажмите клавишу Windows + R и введите % temp%. Нажмите Enter или нажмите ОК.

  2. Выберите все файлы и удалите их.
  3. Теперь снова нажмите Windows Key + R и введите TEMP. Нажмите Enter или нажмите ОК.

  4. Выберите все файлы и удалите их.

После этого проверьте, решена ли проблема. Если вы хотите, вы также можете использовать Disk Cleanup для очистки временных файлов и устранения этой проблемы. Если вам нужен продвинутый инструмент, который будет очищать временные файлы вместе со старыми и ненужными файлами, мы рекомендуем вам попробовать CCleaner. Этот инструмент не только очистит ваш диск, но также проверит ваш реестр на наличие ошибок и очистит ваш кеш, тем самым ускоряя работу вашего ПК.

  • Скачать бесплатную версию CCleaner

Решение 8 — Выполните Чистую загрузку

Если вы продолжаете получать ошибку List index of bounds, возможно, это проблема стороннего приложения на вашем компьютере. Чтобы найти проблемное приложение, рекомендуется выполнить чистую загрузку и отключить все запускаемые приложения и службы. Вы можете сделать это, выполнив следующие действия:

  1. Нажмите клавишу Windows + R. Введите msconfig и нажмите OK или нажмите Enter.

  2. Откроется окно « Конфигурация системы». Перейдите на вкладку « Службы » и установите флажок « Скрыть все службы Microsoft». Теперь нажмите кнопку Отключить все.

  3. Теперь перейдите на вкладку « Автозагрузка » и нажмите « Открыть диспетчер задач».

  4. Когда откроется диспетчер задач, вы увидите список запускаемых приложений. Щелкните правой кнопкой мыши первое приложение в списке и выберите « Отключить» в меню. Повторите это для всех приложений запуска.

  5. После того, как вы отключите все запускаемые приложения, вам нужно вернуться в окно System Configuration. Нажмите Apply и OK, чтобы сохранить изменения и перезагрузить компьютер.

После перезагрузки компьютера проверьте, не устранена ли проблема. Если проблема не появляется, это означает, что ее вызывало одно из приложений или служб запуска. Чтобы точно определить причину, рекомендуется включать приложения и службы по одному или группами, пока вы не найдете причину проблемы.

Как только вы найдете его, удалите проблемное приложение, и проблема должна быть окончательно решена.

Как вы можете видеть, List index of the bounds ошибка может быть довольно проблематичной и препятствовать запуску вашего любимого приложения. Однако вы должны быть в состоянии решить эту проблему, просто переустановив проблемное приложение или обновив его. Если это не сработает, не стесняйтесь попробовать любое другое решение из этой статьи.

ЧИТАЙТЕ ТАКЖЕ:

  • Исправить код ошибки 0xc004e016 в Windows 10
  • ИСПРАВЛЕНИЕ: Dbghelp.dll Фатальная ошибка в Windows 10
  • Полное исправление: ошибки WSClient.DLL в Windows 10, 8.1

Your code is overly complex. You can use the Checked property of the TCheckListBox, and drop the Strings totally when accessing the items in the content (Strings is the default property of Items). Also, you should use the Count of Items in your loop.

Procedure TAppointmentForm.GetAppCost;
Var
  Idx: Integer;
begin
  for Idx := 0 to TreatmentCheckListBox.Items.Count - 1 do
  Begin
    if TreatmentCheckListBox.Checked[Idx] then
    Begin
      Treatment:= TreatmentCheckListBox.Items[Idx];
      GetTreatPrice;
      AppCost:= AppCost + TreatPrice;
    End;
  // The next two lines are a non operation. Assigning a
  // variable to itself does nothing. Remove them entirely
 // Else
 //  AppCost:= AppCost;
    End;
end;

Also, stop concatenating text for your SQL, and use parameterized queries instead, both for efficiency and for protection against SQL injection.

Procedure TAppointmentForm.GetTreatPrice;
Begin
  TreatPriceQuery.SQL.Text:= 'Select Cost from Treatment where TreatName = :TreatName';
  TreatPriceQuery.ParamByName('TreatName').AsString := Treatment;
  TreatPriceQuery.Open;
  TreatPrice:= TreatPriceQuery.FieldByName('Cost').AsInteger;
End;

I agree with @Remy’s content in the comment to your question, as well. You should be passing parameters around instead of using global variables.

function TAppointmentForm.GetTreatPrice(const TreatmentName: String): Integer;
Begin
  TreatPriceQuery.SQL.Text:= 'Select Cost from Treatment where TreatName = :TreatName';
  TreatPriceQuery.ParamByName('TreatName').AsString := TreatmentName;
  TreatPriceQuery.Open;
  Result := TreatPriceQuery.FieldByName('Cost').AsInteger;
End;

Procedure TAppointmentForm.GetAppCost;
Var
  Idx: Integer;
begin
  AppCost := 0;
  for Idx := 0 to TreatmentCheckListBox.Items.Count - 1 do
  Begin
    if TreatmentCheckListBox.Checked[Idx] then
    Begin
      AppCost := AppCost + GetTreatPrice(TreatmentCheckListBox.Items[Idx]);
    End;
  End;
end;

На форме есть компонент sListBox1 (разновидность ListBox1 в Alpha Controls).
Туда добавляются элементы
sListBox1.Items.Add('..........');

В коде мне нужно перебрать все элементы этого sListBox1 . Работа идет в потоке.

procedure TMyThread.Execute;
var
i:integer;
begin
for i:=0 to form1.sListBox1.Items.Count-1 do
begin
full_filename_path:=form1.sListBox1.Items[i];
filename_name:=ExtractFileName(form1.sListBox1.Items[i]);
//.....
end;
end;
end;

При добавлении более одного файла, возникает ошибка
Ошибка listerror list index out of bounds (1).

Как исправить ошибку listerror list index out of bounds?


  • Вопрос задан

    более трёх лет назад

  • 4729 просмотров

Пригласить эксперта

Границы счётчика FOR вычисляется один раз перед циклом. Если в основном потоке меняется form1.sListBox1, то может не оказаться нужного Items[i]. Или проверяйте его наличие. Или используйте цикл WHILE, в котором сравнение счётчика с условием будет проверяться каждый раз.
Замечание: оптимизатор может изменить направление FOR.

Совет: не связывайте модули.
То есть у TMyThread должен быть свой TStrings, в который нужно передать form1.sListBox1.Items.

А если в TMyThread.Execute с использованием Synchronize получить содержимое листбокса и дальше работать с этим содержимым?


  • Показать ещё
    Загружается…

12 июн. 2023, в 18:29

10000 руб./за проект

12 июн. 2023, в 18:11

5000 руб./за проект

12 июн. 2023, в 17:52

1500 руб./за проект

Минуточку внимания

singleping

0 / 0 / 0

Регистрация: 07.03.2017

Сообщений: 1

1

07.03.2017, 07:49. Показов 4194. Ответов 2

Метки делфи7 (Все метки)


Студворк — интернет-сервис помощи студентам

При нажатии на listbox выходит ошибка помогите пожалуйста в чем код неверен!

Delphi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
unit Unit1;
 
interface
 
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, MPlayer, ExtCtrls, jpeg, Menus, ComCtrls;
 
type
  TForm1 = class(TForm)
    ListBox1: TListBox;
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    Button2: TButton;
    Button3: TButton;
    MediaPlayer1: TMediaPlayer;
    Button4: TButton;
    Timer1: TTimer;
    Label1: TLabel;
    Panel1: TPanel;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    N3: TMenuItem;
    Button5: TButton;
    Button6: TButton;
    procedure Button1Click(Sender: TObject);
    procedure ListBox1DblClick(Sender: TObject);
    procedure Panel1Resize(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
      var DoDefault: Boolean);
    procedure Button4Click(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure N2Click(Sender: TObject);
    procedure N3Click(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure ListBox1Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  Form1: TForm1;
  i:integer;
  SL: TStringList;
implementation
 
uses Unit2, Unit3;
 
{$R *.dfm}
 
 
procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
  ListBox1.Items.Add(OpenDialog1.FileName);
  Mediaplayer1.FileName := OpenDialog1.FileName;
  Mediaplayer1.Open;
  end;
end;
 
procedure TForm1.ListBox1DblClick(Sender: TObject);
begin
 if ListBox1.Items.Count > 0 then
  begin
   Mediaplayer1.FileName := ListBox1.Items.Strings[ListBox1.itemindex];
   Mediaplayer1.Play;
  end;
end;
 
procedure TForm1.Panel1Resize(Sender: TObject);
begin
 Mediaplayer1.Stop;
 Mediaplayer1.DisplayRect := Panel1.ClientRect;
 Mediaplayer1.Play;
end;
 
 procedure TForm1.Button2Click(Sender: TObject);
begin
begin
if mpCanPlay in MediaPlayer1.Capabilities then
   begin
   if (MediaPlayer1.Position+10000)<=MediaPlayer1.Length then
      MediaPlayer1.Position := MediaPlayer1.Position + 10000
   else
      MediaPlayer1.Position := MediaPlayer1.Length;
   MediaPlayer1.Play;
   end;
end;
end;
 
procedure TForm1.Button3Click(Sender: TObject);
begin
begin
if mpCanPlay in MediaPlayer1.Capabilities then
   begin
   if MediaPlayer1.Position>=10000 then
      MediaPlayer1.Position := MediaPlayer1.Position - 10000
   else
      MediaPlayer1.Position := 0;
   MediaPlayer1.Play;
   end;
end;
end;
 
procedure TForm1.MediaPlayer1Click(Sender: TObject; Button: TMPBtnType;
  var DoDefault: Boolean);
begin
MediaPlayer1.VisibleButtons := [btPlay, btStop];
if timer1.Enabled=true then
timer1.Enabled:=false else
if timer1.Enabled=false then
timer1.Enabled:=true;
end;
 
procedure TForm1.Button4Click(Sender: TObject);
begin
if mpCanPlay in MediaPlayer1.Capabilities then
   MediaPlayer1.Pause;
if timer1.Enabled=true then
timer1.Enabled:=false else
if timer1.Enabled=false then
timer1.Enabled:=true;
end;
 
procedure TForm1.Timer1Timer(Sender: TObject);
begin
i:=i+1;
label1.Caption:='00:'+ inttostr(i);
 
end;
 
procedure TForm1.FormCreate(Sender: TObject);
begin
label1.Caption:=inttostr(0);
SL:=TStringList.Create;
end;
 
 
procedure TForm1.N1Click(Sender: TObject);
begin
form2.show;
end;
 
procedure TForm1.N2Click(Sender: TObject);
begin
close;
end;
 
procedure TForm1.N3Click(Sender: TObject);
begin
form3.show;
end;
 
procedure TForm1.FormDestroy(Sender: TObject);
begin
SL.Free;
end;
 
procedure TForm1.Button5Click(Sender: TObject);
begin
OpenDialog1.Options:=[ofHideReadOnly,ofAllowMultiSelect,ofEnableSizing];
if OpenDialog1.Execute Then
  Begin
   For I:=0 to OpenDialog1.Files.Count -1 do
    Begin
      SL.Add(OpenDialog1.Files[I]);
     ListBox1.Items.Add(ExtractFileName(OpenDialog1.Files[I]));
    End;
     End;
end;
 
procedure TForm1.ListBox1Click(Sender: TObject);
begin
MediaPlayer1.FileName:=SL.Strings[ListBox1.ItemIndex];
MediaPlayer1.Open;
MediaPlayer1.Play;
end;
 
procedure TForm1.Button6Click(Sender: TObject);
begin
SL.Delete(ListBox1.ItemIndex);
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
 
end.



0



1039 / 855 / 335

Регистрация: 08.12.2016

Сообщений: 3,283

07.03.2017, 16:34

2

Потому, что в SL строк меньше, чем в ListBox1.
Например, если файл добавлен с помощью Button1, а не Button5



0



пофигист широкого профиля

4662 / 3096 / 855

Регистрация: 15.07.2013

Сообщений: 17,855

08.03.2017, 02:11

3

singleping, умейте пользоваться отладчиком.
И умейте читать сообщение об ошибке. В данном случае вам сообщается «List index out of bounds (1)», что в некоем списке элемент с индексом 1 отсутствует. А это значит что в данном списке есть максимум один элемент, или их нет вообще.



0



Понравилась статья? Поделить с друзьями:
  • Как исправить ошибку lineage 2 crash report
  • Как исправить ошибку libcef dll
  • Как исправить ошибку launcher exe
  • Как исправить ошибку lan server class c
  • Как исправить ошибку kmode exception not handled