Hai,
I have a lines in my text file like this
x y
x Y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
let say i have 20 lines like this.
I want to change this lines according to user input. So user will input how many lines they want to change in terms of row and column.
in my program Row=TextBox5.Text column=TextBox6.text
user must enter initial value for x and y. Let say the initial value is x=1 y=1.
Row=2 column=5.. now my lines should look like this.
1 1
2 1
3 1
4 1
5 1
1 2
2 2
3 2
4 2
5 2
x y
x y
x y
x y
x y
x y
x y
x y
x y
x y
since i enter row=2 only two set of lines is change other lines remain unchange.
but in my coding all the lines is changing like this
1 1
2 1
3 1
4 1
5 1
1 2
2 2
3 2
4 2
5 2
1 3
2 3
3 3
4 3
5 3
1 4
2 4
3 4
4 4
5 5
which is wrong.
this is my code
CODE
Dim lines() As String = IO.File.ReadAllLines("C:\wirematches.txt")
Dim xValue As Decimal = Val(TextBox1.Text)
Dim yValue As Decimal = Val(TextBox2.Text)
Dim altValue As Decimal = 2.54
Dim lineTracker As Integer = 0
Dim aX As Decimal
For lineNumber As Integer = 0 To lines.GetUpperBound(0)
If lineTracker = 0 Then
aX = xValue
x = aX.ToString("0.00")
y= yValue.ToString("0.00")
ElseIf (lineTracker = Val(TextBox6.Text)) Then
aX = xValue
yValue = yValue + altValue
x = aX.ToString("0.00")
y = yValue.ToString("0.00")
ElseIf lineTracker > 0 And lineTracker < Val(TextBox6.Text) Then
aX = aX + altValue
x = (aX).ToString("0.00")
y = (yValue).ToString("0.00")
End If
If lineTracker < Val(TextBox6.Text) Then
lineTracker += 1
Else
lineTracker = 1
End If
Next
IO.File.WriteAllLines("C:\wirematchesout.txt", lines)
this code working fine for changes the column. But i dont know where i should write the code for row. Can any one help me