Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
...
## What line is selected:
put the dghilitedline of grp "datagrid" into tLine
## Now fetch the DATA in this line and store it in a variable:
put the dgDataOfLine[tLine] of grp "Your datagrid here" into tData
## tData now contains the complete row: Merke TAB Modell TAB KM TAG Pris
## If you do not need all of the columns, get the one you want to save in "sold cards"
## Set itemdel to TAB
put item 1 of tData into tMerke
put item 2 of tData into tModell
put item 3 of tData into tKM
put item 4 of tData into tPris
## Now store the info you need:
put CR & tMerke after fld "sold cars"
## if not on the current card, add the exact "address: ... of cd "the card with that field of sold cars"
## Or if you have another datagrid with the same columns as the first one use:
## dispatch "AddLine" to group "Your datagrid here" with tData
## Now we can delete that line from datagrid:
dispatch "deleteLine" to grp "datagrid" with tLineNumber
...
I'll send you an email again, can you look at what I did wrong? I'm having trouble understanding why it's not deleting and moving it to 2nd grid under it.
on slettBil
## What line is selected:
put the dghilitedlines of grp "DataGrid" into tLine
## We need to take care of EVERYTHING!
## User did not select a line:
if tLine = EMPTY then
answer "please select a row!"
exit to top
end if
## Now fetch the DATA in this line and store it in a variable:
put the dgDataOfLine[tLine] of grp "DataGrid" into tData
## tData now contains an ARRAY with the data of this row
## Or if you have another datagrid with the same columns as the first one use:
## Use ADDDATA if you want to pass an array like in this case
dispatch "AddData" to group "gridto" with tData
## Now we can delete that line from datagrid:
dispatch "deleteLine" to grp "DataGrid" with tLine
end slettBil