FileDialog in a IronRuby App

Hi all,

How can I call the filedialog window from an IronRuby program, getting
the list of files selected in the dialog in a String or Array variable?

Thank you in advance…

Eduardo B.

require ‘System.Windows.Forms’
include System::Windows::Forms

diag = OpenFileDialog.new
res = diag.show_dialog
if res == DialogResult.OK then
diag.file_names.each { |f| puts “You selected #{f}” }
end

Shay.

Shay F. | Microsoft Visual C#/IronRuby MVP | Author of IronRuby
Unleashed
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay

Thank you Thank you

By the way, I enjoy your book big time, I use it as a great reference…

Eduardo

Shay F. wrote:

require ‘System.Windows.Forms’
include System::Windows::Forms

diag = OpenFileDialog.new
res = diag.show_dialog
if res == DialogResult.OK then
diag.file_names.each { |f| puts “You selected #{f}” }
end

Shay.

Shay F. | Microsoft Visual C#/IronRuby MVP | Author of IronRuby
Unleashed
Blog: http://IronShay.com | Twitter: http://twitter.com/ironshay

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs