Solved

VB 2008  - Attempting to select all DataGridView rows

Posted on 2009-07-09
5
436 Views
Last Modified: 2012-05-07
I am attempting to select all the grid's rows but failing.  I just don't know how to write this code.

Although the grid is named  EvalItemsDataGridView the design-time compiler says it "is not a collection type".

        For Each row As DataGridViewRow In EvalItemsDataGridView
            DataGridViewRow.CurrentRow.Selected = True
        Next
0
Comment
Question by:ljcor
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:divyeshhdoshi
Comment Utility
Hi,


In asp.net gridview you can not select multiple rows at a time. If you try to do  so
using
        For Each row As DataGridViewRow In EvalItemsDataGridView
            DataGridViewRow.CurrentRow.Selected = True
        Next


then it will select last selected row.

To select multiple rows you need to extend functionality of gridview.
http://www.codeproject.com/KB/aspnet/Extend_GridView.aspx
http://www.aspnetworld.com/articles/2007041601.aspx
0
 

Author Comment

by:ljcor
Comment Utility
OK, but let's start with the VB problem I mention in the initial question:  what is wrong with the portion of the statement: EvalItemsDataGridView - when that is the name of the grid?
0
 
LVL 6

Accepted Solution

by:
divyeshhdoshi earned 250 total points
Comment Utility
Datagrid is not a collection

for that you need to specify

        For Each row As DataGridViewRow In EvalItemsDataGridView.Rows
            DataGridViewRow.CurrentRow.Selected = True
        Next
0
 
LVL 47

Assisted Solution

by:Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs) earned 250 total points
Comment Utility
To select all rows, simply use this....

    DataGridView1.SelectAll()

Wayne
0
 

Author Closing Comment

by:ljcor
Comment Utility
Both responses are very helpful to me for other work.  Thanks to each of you.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now