|
-
Feb 16th, 2006, 08:30 AM
#1
Thread Starter
Fanatic Member
Getting selected row ID
Guys,
I am using a C1TrueGrid (ARGHHHH). I am trying to get the id of the selected row, I have grouping applied so the normal methods are giving me the grouped row ID. Really annoying. In their manual, they give this code, but I can't get this working. I'm getting the error at the bottom of the code.
I know its difficult when I'm using non standard controls, but can anybody see the problem ? C1support are not good at giving fast and concise solutions to these issues.
Thanks in advance,
Bob
VB Code:
Dim dv As System.Data.DataView()
Dim cm As CurrencyManager
cm = CType(Me.BindingContext.Item(Me._tgDocLog.DataSource, Me._tgDocLog.DataMember), CurrencyManager)
dv = cm.List
Dim dr As System.Data.DataRow = Me._tgDocLog(Me._tgDocLog.Row)
'ERROR - Value of type 'IList' cannot be converted to '1-dimensional array of DataView'.
"I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings
-
Feb 16th, 2006, 09:04 AM
#2
Re: Getting selected row ID
The fact that you have parentheses after the type in the first line means that you have declared a DataView array, not a single DataView.
-
Feb 16th, 2006, 09:57 AM
#3
Thread Starter
Fanatic Member
Re: Getting selected row ID
Thanks jmc,
I am now getting a specified cast not valid on this line...
Dim dr As System.Data.DataRow = Me._tgDocLog(Me._tgDocLog.Row)
Bob
"I dislike 7 am. If 7 am were a person, I would punch 7 am in the biscuits." - Paul Ryan, DailyRamblings
-
Feb 16th, 2006, 10:04 AM
#4
Re: Getting selected row ID
I've never used that control so I don't know all the ins and outs, but I'd think that if you wanted the DataRow that corresponded to the selected row in the grid then you'd have to go through the DataSource which is you DataView. I'd guess that you should be able to index the DataView by the Position property of the CurrencyManager to get a DataRowView, which has a Row property that is a DataRow from the original DataTable, which I guess is what you want. I'm guessing from your code that the Row property of the grid would give you the same value as the Position property of the CurrencyManager. In short, either of these should work, I think:
VB Code:
Dim dr As System.Data.DataRow = dv(Me._tgDocLog.Row).Row
VB Code:
Dim dr As System.Data.DataRow = dv(cm.Position).Row
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|