I'm trying to write a program to keep track of my finances.
I made a simple GUI with the function to save added data in two different ListViews (one for income, one for outgoing(?))
The following code does not correctly load the data back into the listview.
Code:
ButtonLoadData: ;On button click
Gui, ListView, Inc ;Set focus on ListView with name Inc
getIndex() ;Call getIndex function
Loop, read, %SaveFile% ;loop-read file
{
If A_Index <= (resultInc // 3) ;if the index is equal or smaller than the total divided by 3
{
LV_Add("", A_LoopReadLine, "", "") ;Add line to first column
}
Else if A_Index > (resultInc // 3) && A_Index <= (resultInc - (resultInc // 3)) ;if the index is larger than the total divided by 3 and equal to or smaller
;than the total minus the total divided by 3
{
LV_Add("", "", A_LoopReadLine, "") ;Add line to second column
}
Else ;if index bigger than all that until eof reached
{
LV_Add("", "", "", A_LoopReadLine) ;Add line to third column
}
}
Return
;------------------------------------------------------------------------
getIndex()
{
Loop, read, %SaveFile% ;loop-read file
resultInc := A_Index ;save last index number to variable
Return
}
What it does, is it places all data from the file into the second column in my ListView.
Is there an easier way to retrieve data from a file and get them into the right columns ? (maybe saving the data differently in the first place?)
It currently just saves all columns in one row into a textfile.
That's why I divide by 3, to split the colums.
Also notice this is just the part for the Income.