storyst 发表于 2006-7-30 16:12:00

请问一个遍历的问题

<P>Sub vb()<BR>Dim filename As String<BR>Dim i As Integer<BR>Dim array1 As Variant<BR>&nbsp;&nbsp;&nbsp;&nbsp; filename = Dir("F:\*.*")<BR>&nbsp;&nbsp;&nbsp;&nbsp; i = 0<BR>&nbsp;&nbsp; Do While filename = ""</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; array1(i) = filename<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = i + 1<BR>&nbsp;&nbsp; Loop<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox filename<BR>End Sub<BR>这段为什么不能得到所有F盘下的文件名啊?<BR>求教? </P>

雪山飞狐_lzh 发表于 2006-7-31 07:33:00

<P>Sub tt()<BR>Dim filename As String<BR>Dim i As Integer<BR>&nbsp;&nbsp;&nbsp;&nbsp; filename = Dir("F:\*.*")<BR>&nbsp;&nbsp;&nbsp;&nbsp; i = 0<BR>&nbsp;&nbsp; Do While filename &lt;&gt; ""</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox filename<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; filename = Dir()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i = i + 1<BR>&nbsp;&nbsp; Loop<BR>End Sub</P>
<P>&nbsp;</P>

storyst 发表于 2006-7-31 08:02:00

<P>谢谢斑竹!</P>
页: [1]
查看完整版本: 请问一个遍历的问题