Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Managing Multiple Sessions

Status
Not open for further replies.

sWorks

IS-IT--Management
May 15, 2006
1
US
I found this question in the forum for Attachmate, but it has been archived. I need this EXACT same answer. Where do I find it?

zabx (Programmer) 27 Mar 04 12:26
When programming in Extra Basic or VB with a Extra System object, I have 3 to 4 sessions open and cannot figure out the syntax to chose one of them. Every example seems to be .ActiveSession, which in my case doesn't always pick the session that I want. Is there a way to force it to a session by the session name or some sort of session ID. And possibly even check how many sessions are open? Thanks in advance for any help.
 
Code:
Sub Main()
    Dim Sys As Object
    Set Sys = CreateObject("EXTRA.System")
    SessionCount = Sys.Sessions.Count
    For i = 1 to SessionCount
        ThisName = Sys.Sessions.Item(i).FullName
        If instr(ThisName,"Name your looking for") then
            Set Sess = GetObject(ThisName)
        End If
    Next
End Sub



[thumbsup2] Wow, I'm having amnesia and deja vu at the same time.
I think I've forgotten this before.


 
Yes, you just need to iterate through the open sessions.

This code will add each item to a listbox.

For i = 1 To Sessions.Count
lstSelectSession.AddItem (Sessions.Item(i).Name)
Next i

You just have to loop through them until you find the one you're looking for, then set it as the session you want.

ExtraSession = frmSelectSession.lstSelectSession.ListIndex + 1
Set Sess0 = System.Sessions.Item(ExtraSession) (Instead of Set Sess0 = System.ActiveSession)


calculus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top