Displaying user-inputted text on a different window

Hi, I’m Rene.

I am COMPLETELY new to the world of programming, but would like to know how to do so. I am starting a very simple program for my requirements in a certain subject for school, and would like to learn how to program for this project.

I’ve hit a bump, as I wanted the user to enter his/her name, and display this name on a different window, kind of saying “Hi …”. How can one do so? Thanks for the reply!

What have you tried so far?
Did you go through the Introduction to Programming with Xojo? https://www.xojo.com/learn/

uh oh… homework time again :slight_smile:

see for example https://forum.xojo.com/3148-communicating-between-dialogs-and-main-window/0

Thomas instructions use a dictionary but most of the time a string should be enough

Just make a modal dialog window with an input text field.

Make a prompt event on the window that shows the modal dialog box and returns a value.

The value returned must be a property on the window and not a control as the controls are destroyed before the return value makes it back from the method calling it.

Then you’re good to go!

WindowInputDialog.prompt(Message as string, DefaultInput as string = “”) return String

To use it, do something like:
Dim response as string = windowInputDialog.prompt(“Enter your username:”)

Here is a little project to play with


Also look at



Hey guys, unfortunately, I couldn’t make your solutions work for me. :frowning:

Anyway, I tried to play with the program, and this is the situation:

Welcome (Window 1, where the input name is):

Textbox for name (named as “Name”)

MainMenu (Window 2, where the display Label is)

Label named as “Namebox”

The code right now is:

Button Click at Welcome window

MainMenu.namebox.text = str(name)


MainMenu.namebox.text = Trim(Name.text)

@Albin Kiland Unfortunately, when I write the code you provided, the debugging beforehand does not detect it, however, once I clicked the button (which contains the code), the program hangs. It does not show what the error is though.

Any ideas guys?

Rene, instead of struggling with this for so long, why not go over the introduction for a few days? https://www.xojo.com/learn/
I think things will be a lot easier for you after the introduction. Especially because you said you were completely new to programming.

MainMenu.namebox.text doesnt exist (yet?), so you will be getting a nilobject exception maybe?


dim w2 as new Window2
w2.namebox.caption = Trim(Name.text)

in the button click of the welcome window