writing to a sequential file

propagandhi

Member
Joined
Feb 20, 2005
Messages
18
Programming Experience
Beginner
Alright, i have one.txt document that we will call sales. we have another that we call bonus. sales contains all of the salesperson's information such as name and total sales. Bonus is to contain the bonuses for the salespeople. with my program, you enter the bonus rate and it applies it to all the salespersons records. For some reason, my code is onlywriting one of the bonus amounts to the file for everyone.

Here is the code

strBonus = CDec(txtRate.Text)

swWriter = IO.File.AppendText("sale.txt")

For Each strBonus1 In mdecBonus

strBonus1 = (strBonus * 0.01D) * strTotal

swWriter.WriteLine(strBonus1)

Next strBonus1

swWriter.Close()


any ideas why it doesnt work?
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
instead of: swWriter = IO.File.AppendText("sale.txt")

try

Dim swWriter as StreamWriter("sale.txt")
 

propagandhi

Member
Joined
Feb 20, 2005
Messages
18
Programming Experience
Beginner
for some reason nothing worked so i just wrote a new file to get around it. Any ideas how to make an array with an unknown amount of elements?
 
Top Bottom