Updating a listbox in websessions

I am trying to update a listbox in the current webbpage using the following code -:

For intCounter as Integer = 0 to App.SessionCount - 1
for i as integer = 0 to list.Ubound

A. is there a way to know which of the sessions is my current session
B. it does not seem to update the listbox?

Anyone help?



I see no place where you update the listbox.

Keep it simple. This will list all current sessions into a listbox and fetch your session :

For i As Integer = 0 To App.SessionCount-1 ListBox1.Addrow(App.SessionAtIndex(i).Identifier) if App.SessionAtIndex(i).Identifier = Session.Identifier then //do something end if Next

Looks like the code is updating the caption of a single control named button1 over and over again. Shouldn’t the code be updating Listbox1?

Why did you leave out the second line of my example ? Your issue probably comes from the fact that the array is not initialized.

[quote=226499:@dave duke]Narrowed it down,

app.sessionatindex.identifier returns some sort of GUID
session.identifider (documents say it returns a string, but assigning it to a string throws a missmatch error)

Looks like a bug![/quote]

I don’t know what you are doing. The code I posted works perfectly and uses strings.


Really hope this helps…

[quote=226564:@dave duke]Thanks for your help, still no luck. The issue is inside a socket data received method. Once its fired from there it NOE’s

If you add the code to a data receivedmessage and run it, it will throw a nill object at

  if App.SessionAtIndex(i).Identifier = Session.Identifier then

I guess the socket must not be able to access session.identifier?

it does describe this in websessioncontext, but it is not clear how to access the page components. It talks about

context.Session.CurrentPage = New ExceptionPage

i’m not trying to create new pages, im trying to access components of an existing one for the logged in user.


Sockets indeed need WebSessionContext.

The issue may be somewhat related to the conversation here : https://forum.xojo.com/27338-sessionnotavailableexception-issue-when-creating-container

Socket events fire on the main thread and have no idea which session they came from.

…and yes, follow the thread that Michel quoted. It will make things a lot easier on you.