jaco0646 - Taking some ideas from your code, I've amended mine and have this working with the csv.
The GUI ID's (numbers) are due to this being a part of a tabbed window.
Code:
#SingleInstance force
F1=numbermatch.txt
TestString = 123456,TEST MESSAGE`n
IfNotExist, %F1%
FileAppend,%TestString%, %F1%
Loop,Read,%F1%
{
Line%A_Index% := A_LoopReadLine
Line0 = %A_Index%
}
Gui, Add, ListView,grid r15 w320 -Multi -LV0x10 altsubmit vMyListView gMyListView, Name|Email|WWW|Color|ID
Gui, Add, Button, x25 y275, Add
Gui, Add, Button, x159 y275 gDELETE, Delete
Gui, Add, Button, x299 y275, Update
Gui, Show, ,Number Match
GoSub,FILLLIST
return
Gui, Show, Center w365 h310, Options
FILLLIST:
LV_Delete()
Loop, %Line0%
{
StringSplit, Array, Line%A_Index%, `,
LV_Add("",Array1,Array2,Array3,Array4,A_Index)
}
LV_ModifyCol(1,"75")
LV_ModifyCol(2,"130")
LV_ModifyCol(3,"AutoHdr")
LV_ModifyCol(4,"55")
LV_ModifyCol(5,"0 Integer")
return
MyListView:
if A_GuiEvent = DoubleClick
{
RowNumber := LV_GetNext(0)
if not RowNumber
return
Loop, 5
LV_GetText(A3%A_Index%, RowNumber,A_Index)
editadd = edit
GoSub,SMGUI
}
return
SMGUI:
colors = aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|purple|red|silver|teal|white|yellow
LV_GetText(color,RowNumber,4)
Gui,3:Add,Text, xm Section w80 , Name
Gui,3:Add,Edit, ys-4 w220 vA41, %A31%
Gui,3:Add,Text, xm Section w80 , Email
Gui,3:Add,Edit, ys-4 w220 vA42, %A32%
Gui,3:Add,Text, xm Section w80 , WWW
Gui,3:Add,Edit, ys-4 w220 vA43, %A33%
Gui,3:Add,Text, xm Section w80, Color
Gui,3:Add, ComboBox, ys-4 vA44 SORT, %colours%
GuiControl, 3:Text, A44, %Color%
Gui,3:Add, Button, xm, OK
Gui,3:Show, , TEST
return
3ButtonOK:
3GuiClose:
3GuiEscape:
Gui,3:Submit
Gui,3:Destroy
Gui,1:Default
if editadd = edit
Line%A35% := A41 . "," . A42 . "," . A43 . "," . A44
Else
{
Line0++
Line%Line0% := A41 . "," . A42 . "," . A43 . "," . A44
}
GoSub,FILLLIST
return
DELETE:
RowNumber := LV_GetNext(0)
if not RowNumber
Return
Loop, 5
LV_GetText(A3%A_Index%, RowNumber,A_Index)
Msgbox,4,, Are you sure to delete ?
Ifmsgbox, No
return
Loop, % Line0 - A35 + 1
{
ID := A_Index + A35 - 1
IDNext := ID + 1
Line%ID% := Line%IDNext%
}
Line0--
GoSub,FILLLIST
return
ButtonAdd:
A31=
A32=
A33=
A34=
editadd=add
GoSub,SMGUI
return
ButtonUpdate:
FileContent =
Loop, %Line0%
FileContent := FileContent . Line%A_Index% . "`n"
FileDelete, %F1%
FileAppend, %FileContent%, %F1%
Sleep, 500
;reload
Gui, Destroy
Seems to work OK !