removerow

dennishea

Active Member
Licensed User
When removerow is done doing it's job is it suppose to do the next line of code after it or go back to the begining of the sub it's in?

Sub Table1_SelectionChanged (ColName, Row)
iRow = Row
' Msgbox(row)
txtx1.Text = table1.Cell("x1",iRow)
txty1.Text = table1.Cell("y1",iRow)
txtx2.Text = table1.Cell("x2",iRow)
txty2.Text = table1.Cell("y2",iRow)
txtr.Text = table1.Cell("r",iRow)
z = table1.Cell("Header",iRow)
^
i
i
i most of the time not all it goes back to the beginning of this sub. Sometimes it follows by doing the rest of the code behind it.
table1.RemoveRow(iRow)
mnulabel1.Text = table1.RowCount - 1
DeleteSegment
Drawing
End Sub

dennishea

edit: oh almost forgot and sometimes it doesn't wait for you to prompt it for next line of table it wipes out the whole table.
 
Last edited:

dennishea

Active Member
Licensed User
Thanks agraham. Now I have a direction to go in and as I type this out I think I have a solution. Whoops sorry for think typing gotta go try my thoughts out. Agian thanks agraham.

dennishea

edit: Well that was a bust. I moved this code

table1.RemoveRow(iRow)
mnulabel1.Text = table1.RowCount - 1
DeleteSegment
Drawing

out of there and it didn't do it. After further investigation I descovered that I can delete any row singulerly and it seems to work as intended, but and here's the but if I try to delete the last entered row that's when it goes whole hog rotates through and deletes them all. What I tried to do was create another sub, move those lines of code to it, but when it goes into it's loop thing it leaves the transfer sub after completeing removerow, doesn't do the rest of the code in the transfer sub and goes back to the event sub and continues going back and forth between those two sub's excluding the code after removerow, deleting the rest of the rows.

edit2:
I'm not sure if this is good or not but for the moment it seems to work.
If iRow < count Then
count = table1.RowCount
Return
End If
 
Last edited:

agraham

Expert
Licensed User
Longtime User
You could try this but I can't guarantee it will work as I haven't tested it.

B4X:
Sub Globals
  InSelChgd = false
End Sub

Sub Table1_SelectionChanged (ColName, Row)
If InSelChgd Then Return
  InSelChgd = true
  ...
 table1.RemoveRow(iRow)
  ...

  InSelChgd =false
End Sub
 

dennishea

Active Member
Licensed User
@agraham

I applied your solution and it works great. It is a lot simpler then the one I chose. Many thanks for your help.

dennishea
 
Top