要メモリ1G
ListBoxとButtonを1つずつForm1に配置してからコーディング
----------------------------------
Dim FileName As String
Dim OutFileName As String
Dim openFile1 As New OpenFileDialog()
Dim saveFile1 As New SaveFileDialog()
Dim FileNum As Integer
Dim FileOutNum As Integer
Dim j As Integer = 0
Dim i As Integer = 0
Dim DataBuff As String
Private Structure Info
Public str0 As String
End Structure
Private pInfo(2000000) As Info
Private Sub Button1_Click(・・・) Handles Button1.Click
saveFile1.DefaultExt = "*.txt"
saveFile1.Filter = "保存するファイル名|*.txt"
If saveFile1.ShowDialog() = DialogResult.OK Then
OutFileName = saveFile1.FileName
Else
Exit Sub
End If
FileOutNum = FreeFile()
FileOpen(FileOutNum, OutFileName, OpenMode.Output)
For j = 0 To i - 1
PrintLine(FileOutNum, pInfo(j).str0)
Next
FileClose(FileOutNum)
MessageBox.Show(i, "保存完了")
Me.Close() End Sub
Private Sub ListBox1_DragDrop(・・・) Handles ListBox1.DragDrop
Dim k, ans As Integer
Dim fName As String() = CType(e.Data.GetData(DataFormats.FileDrop, False), String())
ListBox1.Items.AddRange(fName)
ans = UBound(fName)
For k = 0 To ans
FileNum = FreeFile()
FileOpen(FileNum, fName(k), OpenMode.Input)
Do Until EOF(FileNum)
DataBuff = LineInput(FileNum)
pInfo(i).str0 = DataBuff
i += 1
Loop
Next
FileClose(FileNum)
End Sub
Private Sub ListBox1_DragEnter(・・・) Handles ListBox1.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
0 件のコメント:
コメントを投稿