誰かが私に少し助けてくれることを願っていましたか?テキストファイルの行を変更する次のコーディングがあります。基本的に、テキストボックスから数値を読み取り、テキストボックスの数値と一致する行数で別のテキストファイルを作成します。コーディングはうまくいきます。
Dim lines() As String = IO.File.ReadAllLines("C:\test1.txt")
IO.File.WriteAllLines("C:\test1.txt", lines.Skip(CInt(TextBox1.Text)).toarray)
IO.File.WriteAllLines("C:\test2.txt", lines.Take(CInt(TextBox1.Text)).toarray)
今、私はいくつかの変更を加えたいと思っていました.私が望むのは、テキストボックスから数字を読み込んで、5つの別々のテキストファイルを作成することです. たとえば、テキストファイル 1 に 60 行があり、テキストボックス 1 に番号 50 がある場合、コーディングを実行すると、次のテキストファイルが作成されます。
textfile 1 - 10 rows remaining
textfile 2 - 10 rows
textfile 3 - 10 rows
textfile 4 - 10 rows
textfile 5 - 10 rows
textfile 6 - 10 rows
textfile1 に1行しかない場合は、次のようにします
textfile 1 - 0 rows remaining
textfile 2 - 1 rows
textfile 3 - 0 rows
textfile 4 - 0 rows
textfile 5 - 0 rows
textfile 6 - 0 rows
textfile1 が 5 の場合は、次のようになります。
textfile 1 - 0 rows remaining
textfile 2 - 1 rows
textfile 3 - 1 rows
textfile 4 - 1 rows
textfile 5 - 1 rows
textfile 6 - 1 rows
textfile1 が 4 の場合、次のようになります。
textfile 1 - 0 rows remaining
textfile 2 - 1 rows
textfile 3 - 1 rows
textfile 4 - 1 rows
textfile 5 - 1 rows
textfile 6 - 0 rows
など これは可能ですか?どうもありがとう