Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


removerow


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-22-2007, 02:40 PM
Senior Member
 
Join Date: Jul 2007
Posts: 152
Awards Showcase
Beta Tester 
Total Awards: 1
Default removerow

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 by dennishea : 12-22-2007 at 02:43 PM.
Reply With Quote
  #2 (permalink)  
Old 12-22-2007, 03:14 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,896
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

As you are altering the table in an event Sub I supect you are getting re-entered when you invoke RemoveRow which may be causing another Selection Changed event. You should avoid doing things in event Subs that can cause further events to occur.
Reply With Quote
  #3 (permalink)  
Old 12-22-2007, 05:20 PM
Senior Member
 
Join Date: Jul 2007
Posts: 152
Awards Showcase
Beta Tester 
Total Awards: 1
Default

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 by dennishea : 12-22-2007 at 06:58 PM.
Reply With Quote
  #4 (permalink)  
Old 12-22-2007, 07:10 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,896
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

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

Code:
Sub Globals
  InSelChgd = false
End Sub

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

  InSelChgd =false
End Sub
Reply With Quote
  #5 (permalink)  
Old 12-22-2007, 08:05 PM
Senior Member
 
Join Date: Jul 2007
Posts: 152
Awards Showcase
Beta Tester 
Total Awards: 1
Default

@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
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Addrow like removerow(index) Vito Questions & Help Needed 3 02-04-2008 02:09 PM


All times are GMT. The time now is 02:22 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0