Forum: IronRuby Converting an Object to Collection to Bind to DataGridView

Posted by Mohammad Azam (azamsharp)
on 2009-06-18 00:32
Hi,

I have the following code which I am using to bind an object to the
Window Forms dataGridView control:


def bind_customes_to_grid(customer)


$gvCustomers.DataSource = customer

end

Now, I need to convert the customer into a collection so it can be
binding to the DataGridview control. How can I do that?
Posted by Mohammad Azam (azamsharp)
on 2009-06-18 00:34
Here is one possible solution:

def bind_customes_to_grid(customer)

  list = Array.new
  list[0] = customer

$gvCustomers.DataSource = list

end
Posted by Mohammad Azam (azamsharp)
on 2009-06-18 00:36
Here is another version:

def bind_customes_to_grid(customer)

$gvCustomers.DataSource = Array.new.push(customer)

end
Posted by Jimmy Schementi (Guest)
on 2009-06-18 01:27
(Received via mailing list)
Did you take a look at how the example I sent you worked?

http://github.com/jschementi/railsconf09/blob/master/8-ardb/app.rb

~js
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.