Interesting.
I found that although this method worked great for loading the window based on a string, the window itself did not behave normally. It would not respond to code that closes the window. So, if in the program, you moved to another window, the code I had to close the outgoing window would be ignored. It's almost like it was launched in a different way. I'm not familiar with the case command and how it works....might have something to do with that.
Real suggested I use something as simple as
if roomsavedlist = "Lobby" then
lobby.show
I would just have to do that for every window I had.....so.....
I slightly modified Doofis code to do this for me.
I replaced the middle part with this
//build up the output source code
dim codeLines() As String
for i As integer = 0 to winNames.Ubound
codeLines.Append "if roomsavedlist = """ + winNames(i) + """" + " then"
codeLines.Append winNames(i) + ".show"
codeLines.Append "end"
next
And that now works perfectly, seems cleaner, and most importantly, the window responds to the code closing it!
Your code is very flexible, Doofus. I like it a lot!