<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VB: For Each, индекс элемента]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=5582&amp;type=atom" />
	<updated>2011-03-11T12:55:53Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=5582</id>
		<entry>
			<title type="html"><![CDATA[Re: VB: For Each, индекс элемента]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=46069#p46069" />
			<content type="html"><![CDATA[<p><strong>2 Dmitrii:</strong> Точно. ) Благодарю за исправление.</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2011-03-11T12:55:53Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=46069#p46069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VB: For Each, индекс элемента]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=46065#p46065" />
			<content type="html"><![CDATA[<div class="quotebox"><blockquote><p>Lirien, в массиве i(3) не три, а четыре элемента, т.к. минимальное значение индекса не 1, а 0.</p></blockquote></div><p>Спасибо, насчет этого я в курсе <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>В общем так и сделал - перебором. Я просто предположил, что есть какая-нибудь штатная компонента конструкции For Each.</p><p>Всем спасибо за помощь!</p>]]></content>
			<author>
				<name><![CDATA[Lirien]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26763</uri>
			</author>
			<updated>2011-03-11T12:35:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=46065#p46065</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VB: For Each, индекс элемента]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=46064#p46064" />
			<content type="html"><![CDATA[<p><strong>Lirien</strong>, в массиве <strong><span style="color: blue">i(3)</span></strong> не три, а четыре элемента, т.к. минимальное значение индекса не 1, а 0.</p><div class="quotebox"><cite>Xameleon пишет:</cite><blockquote><div class="codebox"><pre><code>For j=1 to Ubound(i)
   a = i(j)
Next</code></pre></div></blockquote></div><p>Для перебора всех элементов правильный вариант либо таков:<br /></p><div class="codebox"><pre><code>For j=1 to Ubound(i) + 1
   a = i(j - 1)
Next</code></pre></div><p>либо таков:<br /></p><div class="codebox"><pre><code>For j=LBound(i) to Ubound(i)
   a = i(j)
Next</code></pre></div><p><img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2011-03-11T12:21:52Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=46064#p46064</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VB: For Each, индекс элемента]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=46062#p46062" />
			<content type="html"><![CDATA[<p>Самый просто способ - параллельным наращиванием счётчика в цикле (<strong>c = c +1</strong>). Либо перебирать элементы через<br /></p><div class="codebox"><pre><code>For j=1 to Ubound(i)
   a = i(j)
Next</code></pre></div><p>P.S Не забывайте указывать в заголовке сообщения язык на котором написан скрипт. В вашем случае <strong>VBS</strong> или <strong>VBScript</strong>. - &quot;<strong>VBS:For Each.. Индекс элемента.</strong>&quot;. Пункт правил 3.1.</p>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2011-03-11T12:02:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=46062#p46062</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[VB: For Each, индекс элемента]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=46061#p46061" />
			<content type="html"><![CDATA[<p>Добрый день,</p><p>Я все еще плаваю в вопросах VB<br />Подскажите, пожалуйста, возможно ли получить индекс элемента массива, полученного с помощью конструкции For Each?</p><div class="codebox"><pre><code>dim index
dim i(3)
i(0) = 2
i(1) = 1
i(2) = 3

For Each j in i
if j = 3 then
index = ..... &#039; Индекс 2 элемента i(2)
end if
Next</code></pre></div><p>Спасибо!</p>]]></content>
			<author>
				<name><![CDATA[Lirien]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26763</uri>
			</author>
			<updated>2011-03-11T11:56:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=46061#p46061</id>
		</entry>
</feed>
