Question

I installed IronRuby on my computer and wanted to try simple things like creating a window:

require "System.Windows.Forms"
include System::Windows::Forms
form = Form.new
form.Title = "Hello IronRuby" # This doesn't work. ("Undefined method Title= for System.Windows.Forms.Form")
form.Show

This is not the only strange thing. When I Show a Windows Form, (without trying to set the title) the Form instantly crashes. Did I make something wrong or is this a bug or something different?

Screenshot of my problem

EDIT: The problem with form.Title was solved by Paul Lambert. By I'm still wondering, if it is normal, that the Forms crash instantly, when I call form.show?

Était-ce utile?

La solution

Use form.Text instead of form.Title. See this start-up guide

Edit: I don't think the script crashes, but merely exits instantly, since the form is non-modal and no controls or handlers are defined. Replace form.Show with form.ShowDialog for the window to persist until the user closes it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top