-3
予約と支払いのためのシステムを構築しようとしていますが、現在は複数の変数をファイルに保存しています。私がする必要があるのは、設定されたbookingIDに支払いを追加することです。変更された支払い合計をファイルに追加するようにソートしましたが、古いものを削除することはできません。したがって、ファイルを検索すると、顧客が£50を支払った古いものと、£100を支払った最新のものではなく、古いものが最初に見つかる。だから私はファイルから読んで、私はそれからデータで行う必要があるすべてを行うと、その1行のデータを削除し、次に私は新しいデータを追加する方法を知っている。ここでそれを見て、それは私を大いに混乱させました。事前にvb.netのテキストファイルから行を削除する
おかげ
それはデータを検索し、彼らはたぶん
Dim bookings As String
bookings = "E:\Grouse Lodge Bookings\Bookings.txt"
bookingidtemp = txtbookingid.Text
FileOpen(1, bookings, OpenMode.Input)
found = False
If temp = True Then
If found = False Then
Do Until found = True
Input(1, custname)
Input(1, address1)
Input(1, address2)
Input(1, cost)
Input(1, amount)
Input(1, startdate)
Input(1, enddate)
Input(1, postcode)
Input(1, bookingid)
Input(1, remaining)
If bookingidtemp = bookingid Then
txtname.Text = custname
txtaddress1.Text = address1
txtaddress2.Text = address2
txtcost.Text = cost
txtstartdate.Text = startdate
txtenddate.Text = enddate
txtpostcode.Text = postcode
txttopay.Text = remaining
found = True
FileClose(1)
Else
End If
Loop
End If
If found = False Then
MsgBox("Booking not found, please try again")
FileClose(1)
Else
If found = True Then
FileOpen(1, bookings, OpenMode.append)
custname = txtname.Text
address1 = txtaddress1.Text
address2 = txtaddress2.Text
cost = txtcost.Text
amount = txtpaid.Text
startdate = txtstartdate.Text
enddate = txtenddate.Text
postcode = txtpostcode.Text
bookingid = txtbookingid.Text
cost = txtcost.Text
amount = txtpaid.Text
paying = remaining - amount
remaining = paying
amount = cost - remaining
WriteLine(1, custname, address1, address2, cost, amount, startdate, enddate, postcode, bookingid, remaining)
FileClose(1)
MsgBox("Payment added")
テキストファイルはランダムアクセスではありません。 1行を変更する唯一の方法は、ファイル全体をもう一度書き出すことです。データベースを考えてみましょう。また、[お問い合わせ]を読んで[ツアー]を受けてください – Plutonix
何を試しましたか?特に、[最小限の、完全で実証可能な例(MCVE)](https://stackoverflow.com/help/mcve)を使用しない限り、私たちの誰もあなたを助けることはできません。これを説明するには、これまでに書いたコード、サンプル入力(もしあれば)、期待される出力、実際に得られる出力(コンソール出力、トレースバックなど)を含めることです。あなたが提供する詳細があれば、受け取る可能性のある回答が増えます。また、[FAQ](http://meta.stackexchange.com/q/7931)と[ask](https://stackoverflow.com/help/asking)もチェックしてください。 –
質問に追加しました。未経験者のために申し訳ありません! –