Re: Stack over flow?



rick-paulos@xxxxxxxxx wrote:
VB6


It looks to me that setting grid.rowsel is calling the sub (recursion)

Stands to reason, since the event handles selection changes.

and that causes the stack over flow.
Any alternative suggestions on how can I limit row selection to a
single row?

Below illustrates a generally useful way for blocking recursion on event
handlers.



Private Sub Grid_SelChange()

Static Busy As Boolean
If Not Busy Then
Busy = True

'reduce multi row select to single row
Grid.RowSel = Grid.Row
currentgridrow = Grid.Row
'update caption to show db stats & selected row
Mainform.Caption = version + racename + " - " +
EventName(currentevent) + " - " + Str(numberofentrants) + "/" +
Str(entrantsinevent) + " - " + Str(currentgridrow)

Busy = False
End If

End Sub




.



Relevant Pages

  • Re: Class Events
    ... "large" label. ... for each of the grid labels. ... > Just run userform1 and make a selection on the grid using left mouse ... > Private Sub UserForm_Initialize ...
    (microsoft.public.excel.programming)
  • Re: Command Button question
    ... The form includes a listbox, a textbox and a command button. ... If the user makes a selection on teh list box, ... Private Sub lstManager_Enter ... Me.btnAddRemoveManger.Caption = "Remove Manager" ...
    (microsoft.public.excel.programming)
  • Re: extraction VB code
    ... Sub extractall() ... '' so the Selection is this - where noduplicaterows leaves off - I believe. ... '' Get a specific reference to the added sheet. ... > I've put together this code to extract and id code data from an excel ...
    (microsoft.public.excel.programming)
  • Re: Shape instead of Target
    ... You select this macro. ... I then had it called from sub Worksheet_SelectionChange and got a run type ... Dim strSelectedShape As String ... If the selection is a named range then Shape.Name returns the ...
    (microsoft.public.excel.programming)
  • Re: Method to query all items from a multiselect=none listbox???
    ... I had a RefreshQuery Sub with all criterias for the SQL string. ... I have replaced Sub by Fonction in my Form, declared Dim RefreshQuery ... I have tried to set the box as Sinlge or Extended selection but then ...
    (microsoft.public.access.formscoding)