Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4237982
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:50:43+00:00 2026-05-21T02:50:43+00:00

I have written an Extension Method off of DataGridView called HideColumns. public static class

  • 0

I have written an Extension Method off of DataGridView called HideColumns.

public static class Extensions
{
    public static void HideColumns(this DataGridView dataGridView, params string[] columnNames)
    {
        foreach (string str in columnNames)
        {
            if (dataGridView.Columns[str] != null)
            {
                dataGridView.Columns[str].Visible = false;
            }
        }
    }

}

I pass my grid into an IronRuby script as a variable called main_grid

When my script calls
main_grid.HideColumns(“FirstName”,”LastName”)
the script blows up with Error in Script
undefined method ‘HideColumns’ for System.Windows.Forms.DataGridView:System::Windows::Forms::DataGridView

The extension methods seem to work okay from C#. What gives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:50:43+00:00Added an answer on May 21, 2026 at 2:50 am

    FWIW, IronRuby 1.1 (needs .net 4) provides the using_clr_extensions method — as noted in the release notes this activates all extension methods defined on classes defined in a given namespace, regardless of the assembly they are defined in; assemblies loaded in the future that define extension methods in the activated namespace will automatically appear on the correct types, like this:

    load_assembly "System.Core"
    using_clr_extensions System::Linq
    
    # ...
    
    products.
      where(lambda { |p| p.units_in_stock == 0 }).
      each { |x| puts x.product_name }
    

    The release notes also point at a whole set of examples at http://github.com/ironruby/ironruby/blob/master/Languages/Ruby/Samples/Linq/101samples.rb

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following extension method written: static public IQueryable<OutboundPattern> ByClientID(this IQueryable<OutboundPattern> qry, int clientID)
I have an extension method with the following signature: public static Expression<Func<T, bool>> And<T>(this
I have a class library with some extension methods written in C# and an
I have written an extension method for string manipulation. I'm confused what should I
I am writing some unit tests for an extension method I have written on
I have written an extension method in csharp for an MVCContrib Html helper and
Has anyone written a nice extension method 'library' for System.Drawing.Color. Would be nice to
I have written a Python extension library in C and I am currently using
I have written an AIR Application that downloads videos and documents from a server.
I have written some code in my VB.NET application to send an HTML e-mail

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.