CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Question Filling Property data into DataGridView

    hi friends , i have been trying to fill datagridView .but i am getting the folloiwng error .
    Error 2 The best overloaded method match for 'System.Windows.Forms.DataGridViewColumnCollection.Add(System.Windows.Forms.DataGridViewColumn)' has some invalid arguments C:\TradingSummary\TradingSummaryStatus\FrmBrands.cs 73 17 TradingSummaryStatus
    Error 3 Argument '1': cannot convert from 'string' to 'System.Windows.Forms.DataGridViewColumn' C:\TradingSummary\TradingSummaryStatus\FrmBrands.cs 73 43 TradingSummaryStatus


    Code:
     public void FillBrandMaster(){
                foreach (Brand _brand in _brands)
                    dataGridView1.Columns.Add(_brand.BrandID).ToString();                
    
    
            }

  2. #2
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Filling Property data into DataGridView

    In your original code, You have the .Tostring in the wrong place. The way you have it, you are trying to ".ToString" the .ADD method of the columns collection of the datagridview. I assume you what to "ToString" the brandID. So change the code to...

    Code:
     public void FillBrandMaster(){
                foreach (Brand _brand in _brands)
                    dataGridView1.Columns.Add(_brand.BrandID.ToString());                
    
    
            }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured