CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2012
    Posts
    5

    help datagrid virtual mode please

    Hello:

    I have a big array of string and I need fast way to load this strings in a datagrid rows using virtual mode datagridview.

    Please Can you help me?

    Thank you very much

  2. #2
    Join Date
    Jul 2012
    Posts
    90

    Re: help datagrid virtual mode please

    You need to put the strings into an object that implements IEnumerable (such as a List<string>), then you can just DataBind the list to the DataGridView.

  3. #3
    Join Date
    Sep 2012
    Posts
    5

    Re: help datagrid virtual mode please

    Quote Originally Posted by CGKevin View Post
    You need to put the strings into an object that implements IEnumerable (such as a List<string>), then you can just DataBind the list to the DataGridView.
    Hi CGKevin:

    If i have a List of string named str, how can I put his items in datagridview rows with datagrid virtual Mode?

    Is possible you show me the correct code?

    I think i need:

    DataGridView1.VirtualMode = True

    CellValueNeeded.(I donĀ“t know can i use it)

    But I don`t know the way to do it.


    Thank you very much.

  4. #4
    Join Date
    Jul 2012
    Posts
    90

    Re: help datagrid virtual mode please

    See this Microsoft article on using virtual mode with a DataGridView. http://msdn.microsoft.com/en-us/library/2b177d6d.aspx

  5. #5
    Join Date
    Sep 2012
    Posts
    5

    Re: help datagrid virtual mode please

    Hi CGKevin:

    I see the link but I don't understand.

    Is possible you help me with code?

    I need put the items of list or array string in datagridview rows.

    Thank you very much

  6. #6
    Join Date
    Jul 2012
    Posts
    90

    Re: help datagrid virtual mode please

    The upshot is that if you are going to use virtual mode, that means you are not going to allow the DataGrid to manage it's data binding, you are going to code the DataGrid's data access yourself. While there are legitimate resons to do this, if you are a beginner, unless you have a compelling reason, you should probably allow the DataGrid to handle data access via it's built in data binding. The MS example gives you all the code you need to program the virtual mode of the DataGridView. I'm not sure what my re-writing that code would do for you.

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