Using CellTagAt in WebListBox to grab some data throws an "event loop" crash

I’ve encountered something very odd. I am attempting to load and play a YouTube video in a WebHTMLViewer. I have a listbox that is populated with the names of the videos. My thought was to use CellTagAt to populate each video with its respective YouTubeID. When I use CellTagAt and select a video, the app immediately crashes and just shows “Event Loop”

But if I put the YouTubeID in a second column, and call the SelectedRowIndex, it loads and plays just fine

Here’s some of my code:

Populating the WebListbox:

'MySQL connection above this to grab the details
while not rs.AfterLastRow
  lbxMovies.CellTagAt(lbxMovies.LastAddedRowIndex, 0) = rs.Column("YouTubeID").StringValue
  lbxMovies.CellTextAt(lbxMovies.LastAddedRowIndex, 1) = rs.Column("YouTubeID").StringValue

These next two are in the listbox’s SelectionChanged (one works, one doesn’t):

'This one uses the CellTagAt and throws the Event Loop error
HTMLViewer1.LoadURL("" + me.CellTagAt(me.SelectedRowIndex, 0) + "?rel=0&autoplay=1")
'This one uses the CellTextAt and looks at the second column
'It works, but this leaves an additional unwanted column in the listbox as WebListBoxes cannot have "hidden" columns
HTMLViewer1.LoadURL("" + me.CellTextAt(me.SelectedRowIndex, 1) + "?rel=0&autoplay=1")

The funny thing is that I am successfully using CellTagAt in another part of the app to store and get the table’s ID column. I tried this too (storing the ID in the tag and making another call to the db, but the Event Loop error showed)


What happens if you try this?

Var s as string=me.CellTagAt(me.SelectedRowIndex, 0)

HTMLViewer1.LoadURL("" + s + "?rel=0&autoplay=1")

In case you still get an issue, put a breakpoint at the first line and step to the 2nd one. You’d then point the problem more precisely.

Thanks for the reply Arnaud. Same result. Here are screenshots of each step through the break points

dim s as String = me.CellTagAt(me.SelectedRowIndex, 0)

HTMLViewer1.LoadURL(“YouTube” + s + “?rel=0&autoplay=1”)

End Sub

4th step after End Sub

Are there any details you want to see in the Variables?

When you are in the “Event Loop” pause, have you tried pressing the “Run” button (if it’s available)?
I’ve seen times where the hang you’re getting could be resumed that way.

The Resume button is active. Clicking once brings the loop again. Clicking a second time clears the loop, but the video never plays. I am able to select another video from the list, go through the breaks, click resume, and same result unfortunately

For web framework, sometimes when the debugger pauses for seemingly no reason with no editor selected, this can mean that there’s a runtime exception being caught internally. The only way to have these fixed is to open a ticket with a reproducible project.

1 Like

At this point, I’d inspect the strings (both from CellTag and CellText with the 2nd column). Since your code works using a 2nd column but not using CellTag (even by passing by a variable), and accessing a string from CellTag usually works, I’d expect both strings to have a difference.

The first thing you could try is confirming accessing the CellTag alone doesn’t crash. You’d temporarily comment out the HTMLViewer1.LoadURL statement and replace it by:

Var s as string=me.CellTagAt(me.SelectedRowIndex, 0)

MessageBox s //or break, or nothing

If this also crashes, there’s an issue in simply accessing the tag (which you’d report with a bug report).

If it doesn’t crashes here, you could compare both strings:

Var s as String=me.CellTagAt(me.SelectedRowIndex, 0)
Var t as String=me.CellTextAt(me.SelectedRowIndex, 1)


Carefully inspect and compare s and t (both the content, even as binary, in the IDE, and check that the encoding is correct in both strings).

Please report your findings.

1 Like

Thanks guys. I’m taking the weekend off but will build a small test project Monday and submit a feedback if warranted after testing. Will keep you posted

Sadly, something very odd must be happening with my app. I made a small test app and included 4 listboxes all populated with the same 3 videos, YTID, and celltag

  • listbox1 was loading the video via the second column
  • listbox2 was loading via calling the CellTagAt directly
  • listbox3 was loading via calling a string variable that housed the CellTagAt
  • listbox4 was simply to load the CellTagAt into a string variable and then populate a label

All worked well with no loop crashes. Bummer

Back in my app, I attempted all of the above. The only one which worked was loading the video via the second column. Using CellTagAt crashed with the loop no matter how I did this. I also tried the populating the CellTagAt data into a label as in my listbox4 example in my app, and this worked with no crash

Variables s and t matched up exactly, which was the hopeful expectation, but unfortunately, does not help me find the error

Since I cannot reproduce the error in a test project, I will just have to chalk this up to a ghost in the code somewhere and will have to maintain the second column with the YTIDs. It’s not ideal, but at least it works

Thanks again all for your help!