|  | ■No85004 (Azulean さん) に返信 > ■No85003 (魔界の仮面弁士 さん) に返信
 >>Private history As New HashSet(Of String)()
 >
 > 一点だけ。
 > 大文字小文字は区別しないようにしておいた方が良さそうです。
 >
 > Private history As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
 
 お二人の方無事出来ました。ありがとうございます。
 
 もう一点だけ教えてください。
 
 一度ファイルを開いたときにすべてクリアーした時に、再度同じファイルを開く場合
 
 Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
 '全てのリスト全消し、クリアー
 ListBox1.Items.Clear()
 ListBox2.Items.Clear()
 AxWindowsMediaPlayer1.Ctlcontrols.stop()
 AxWindowsMediaPlayer1.currentPlaylist.clear()
 Timer1.Stop()
 Timer2.Stop()
 Timer3.Stop()
 TextBox2.Clear()
 TextBox3.Clear()
 MessageBox.Show("全てのリストをクリアーしました",
 "報告",
 MessageBoxButtons.OK,
 MessageBoxIcon.Asterisk)
 end sub
 
 
 Private history As New HashSet(Of String)()
 Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
 Dim files = OpenFileDialog1.FileNames
 Dim conflict = files.Where(AddressOf history.Contains)
 
 If conflict.Any() Then
 e.Cancel = True
 Dim fileNames = conflict.Select(AddressOf System.IO.Path.GetFileName)
 MessageBox.Show("以前と同じファイルは選択できません。" & vbCrLf & String.Join(vbCrLf, fileNames), "競合", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
 Else
 Array.ForEach(files, AddressOf history.Add)
 End If
 End Sub
 
 クリアーした時もう一度同じファイルを開く時に同じファイルがある。
 
 このクリアーした後に再度同じファイルを開くにはどうしたらいいでしょうか。
 
 すいません。
 
 
 |