テキストファイルを配列化したい
        投稿者 あにす  (社会人)
        
        投稿日時 
            2008/11/25 20:55:51
        
    
    
        ファイル名に連番を含めたファイルを配列に読み込むということでしょうか?
こんな感じでしょうか?
    
Imports System.IO
Module Module1
    Sub Main()
        Dim fileList(9) As String
        For Each file As String In Directory.GetFiles(".", "*.txt", SearchOption.TopDirectoryOnly)
            Dim fileNumber As Integer
            Dim fileName As String = Path.GetFileNameWithoutExtension(file)
            If fileName.StartsWith("g") AndAlso Path.GetExtension(file) = ".txt" AndAlso Integer.TryParse(fileName.Substring(1), fileNumber) AndAlso 0 <= fileNumber AndAlso fileNumber <= 9 Then
                Using sr As New StreamReader(file)
                    fileList(fileNumber) = sr.ReadToEnd()
                    sr.Close()
                End Using
            End If
        Next
    End Sub
End Module
こんな感じでしょうか?
        投稿者 にぃや♪  ()
        
        投稿日時 
            2008/11/25 21:13:42
        
    
    
        超ウルトラ入門者質問をしてしまったようです。
普通にStringで宣言できるんですね。
ありがとうございました。
    
    
普通にStringで宣言できるんですね。
ありがとうございました。
        投稿者 にぃや♪  ()
        
        投稿日時 
            2008/11/25 21:27:09
        
    
     Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        picture_clear()
        If ListBox1.SelectedIndex = 0 Then Return
        picture(ListBox1.SelectedIndex - 1).Visible = True
        Using reder As New StreamReader(txt(ListBox1.SelectedIndex - 1))
            TextBox1.Text = reder.ReadToEnd
        End Using
    End Sub
いい感じになりました。
上級者が多いのかな?
テキストファイルを配列化できますか?
kari(0)=g1.txt
kari(1)=g2.txt
みたいな。