|
-
Mar 2nd, 2004, 03:16 AM
#1
Thread Starter
New Member
RE: DataTable Select method and binding
This is getting urgent - someone please help...
I have a datatable "Employees" with bound fields on a form. I use the following code to find a specific record - this works well:
Function Find(ByVal sExpression As String) As CEmployeeRecd
Dim DRs() As DataRow
Dim DTEmployee As DataTable
Dim EmployeeRecd As CEmployeeRecd
Find = Nothing
Try
'Get reference to the Employee table...
DTEmployee = m_DS.Tables("Employees")
DRs = DTEmployee.Select(sExpression)
If DRs.GetLength(0) <> 0 Then
EmployeeRecd = New CEmployeeRecd()
If Not IsDBNull(DRs(0)("LastName")) Then
EmployeeRecd.LastName = CStr(DRs(0)("LastName"))
End If
If Not IsDBNull(DRs(0)("FirstName")) Then
EmployeeRecd.FirstName = CStr(DRs(0)("FirstName"))
End If
...
Find = EmployeeRecd
End If
Catch Ex As Exception
Throw Ex
End Try
I now want the bound controls to show the found datarow. How do i achieve this in code.
(The Datarow class has an rowID field - which is private. I was hoping to set the
BindingManagerBase.postion to rowID - this isn't possible). Any ideas.
Thanks
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
|