PC Review


Reply
Thread Tools Rate Thread

Accessing Data in DataGrid

 
 
Bruce LeMond
Guest
Posts: n/a
 
      22nd Aug 2003
I'm wanting to check a column in a datagrid and take some
action if it equals a certain value. I have the following
Code:

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As
Object, ByVal e As System.EventArgs) Handles
DataGrid1.CurrentCellChanged
rows = DataGrid1.CurrentCell.RowNumber
cols = DataGrid1.CurrentCell.ColumnNumber
End Sub

And then I have the following if statement somewhere else
in the program:

If DataSet1.Tables("ItemsOrder").Rows(rows)("Class") = "S"
Then
DisplaySpecialClass()
End If

When I tried running it, I'm still not getting the data
from the datagrid row that I selected. What would I be
doing wrong?

Thanks in advance.

 
Reply With Quote
 
 
 
 
Ken Tucker
Guest
Posts: n/a
 
      22nd Aug 2003
Hi,

Dim dgCell As DataGridCell

dgCell = DataGrid1.CurrentCell

MessageBox.Show(DataGrid1.Item(dgCell).ToString)


Ken
-----------
"Bruce LeMond" <(E-Mail Removed)> wrote in message
news:03b201c368f6$0c2f5d20$(E-Mail Removed)...
> I'm wanting to check a column in a datagrid and take some
> action if it equals a certain value. I have the following
> Code:
>
> Private Sub DataGrid1_CurrentCellChanged(ByVal sender As
> Object, ByVal e As System.EventArgs) Handles
> DataGrid1.CurrentCellChanged
> rows = DataGrid1.CurrentCell.RowNumber
> cols = DataGrid1.CurrentCell.ColumnNumber
> End Sub
>
> And then I have the following if statement somewhere else
> in the program:
>
> If DataSet1.Tables("ItemsOrder").Rows(rows)("Class") = "S"
> Then
> DisplaySpecialClass()
> End If
>
> When I tried running it, I'm still not getting the data
> from the datagrid row that I selected. What would I be
> doing wrong?
>
> Thanks in advance.
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing datagrid cell Sam Microsoft ASP .NET 3 2nd Apr 2006 10:50 PM
Accessing data from a control added to a PlaceHolder in Datagrid. =?Utf-8?B?S2FseWFuaQ==?= Microsoft C# .NET 0 7th Jun 2005 09:40 AM
datagrid - accessing data in a row gregoryenelson Microsoft ASP .NET 1 30th Nov 2004 08:51 AM
newbie: accessing data in a datagrid steve Microsoft VB .NET 3 3rd Nov 2004 10:08 AM
...Accessing a datagrid across frames... dj Bass Microsoft ASP .NET 1 16th Jul 2003 07:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:17 PM.