BTW,

DataGridView's Row has a property DataBoundItem this property returns the
DataRowView in case you have bind the DataGridView with a BindingSource.
Therefore casting can be done,

Dim drv as DataRowView
Dim objDataRow as DataRow

drv = Me.DataGridView1.Rows(0).DataBoundItem, DataRowView
objDataRow = drv.Row

On Wed, Oct 13, 2010 at 4:12 AM, Jeff Steinkamp (N7YG) <
[email protected]> wrote:

> ?Actually, this was a lot easier to do than I thought.  I have a Datasource
> (ds) that is tied to a BindingSource and the DataGrivdView so I just did the
> following
>
>        For Each row As DataRow In ds.Tables(0).Select(userFilter)
>
>                'do the specialized processing on the row
>               Next
>
> Now that I have proved this works, I can eliminate about 50 lines of code
> with another routine where I am processing each cell in the grid by pulling
> a compete row and do the processing in a couple lines of code.
>
>
>
> Jeff K. Steinkamp N7YG
> Tucson, AZ
> SCUD Missile Coordinates:
> N032-13-55.02  W110-55-52.79
> Registered Linux User: 420428
> ------------------------------------------------------
>
> Whoever profits by the crime is guilty of it.
>
>
> --------------------------------------------------
> From: "Stephen Russell" <[email protected]>
> Sent: Tuesday, October 12, 2010 5:31 AM
> To: <[email protected]>
> Subject: Re: [DotNetDevelopment] Cast a DatagridView row to a DataRow
>
>
>  On Mon, Oct 11, 2010 at 10:51 AM, Jeff Steinkamp (N7YG) <[email protected]>
>> wrote:
>>
>>> I have a DatagridView that is populated from a SQL statement.  The user
>>> has
>>> the option of filtering that DataGridView even further.  What I need to
>>> be
>>> able to do is either cast the filtered results back to a DataTable, or
>>> iterate over the filtered results and cast each row back to a DataRow so
>>> I
>>> can feed that to a specialized  export routine.
>>>
>>> Any idea how to accomplish this?
>>>
>> -----------------------
>>
>> You were so close.
>>
>> DataView :
>>
>> <http://davidhayden.com/blog/dave/archive/2006/02/11/2798.aspx>
>>
>>
>> DataView to DataTable:
>> <http://www.daniweb.com/code/snippet217027.html>
>>
>>
>>
>> --
>> Stephen Russell
>>
>> Sr. Production Systems Programmer
>> CIMSgts
>>
>> 901.246-0159 cell
>>
>
>

Reply via email to