473,472 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't bind to dataview.findrows result

I'm using findrows to extract specific rows from a dataview, and then want to
bind to them.

I'd assumed that you bound to the array result as you would to the the
dataview, but the system can't find the named col/item.

Dim dv As New DataView
dv.Table = ds.Tables("Replicate_Characters")
dv.RowFilter = ""
dv.Sort = "ReplicateID"
Dim drv() As DataRowView = dv.FindRows(195)
bmb = Me.BindingContext(drv)
txt_no.DataBindings.Add("Text", drv, "CharNo")
txt_min.DataBindings.Add("Text", drv, "CharMin")
txt_max.DataBindings.Add("Text", drv, "CharMax")
bmb.Position = 0

I've verified that following the findrows drv contains 3 rows, so it's not a
problem there, and if I bind directly to the dataview(dv) there's no problem.

Can anyone please advise as to where I'm going wrong?

Many thanks for any help!

Niki
--
Niki Reid
DARD, Belfast
Nov 21 '05 #1
4 4160
Hi,

"Niki" <Ni**@discussions.microsoft.com> wrote in message
news:14**********************************@microsof t.com...
I'm using findrows to extract specific rows from a dataview, and then want
to
bind to them.

I'd assumed that you bound to the array result as you would to the the
dataview, but the system can't find the named col/item.

Dim dv As New DataView
dv.Table = ds.Tables("Replicate_Characters")
dv.RowFilter = ""
Is there any reason why you can't use the row filter and bind to the dv:
dv.RowFilter = "ReplicateID = 195"

You can not bind to array's because they don't implement IList or any other
usefull interfaces for binding, you can bind to a single DataRowView though.

hth,
Greetings
dv.Sort = "ReplicateID"
Dim drv() As DataRowView = dv.FindRows(195)
bmb = Me.BindingContext(drv)
txt_no.DataBindings.Add("Text", drv, "CharNo")
txt_min.DataBindings.Add("Text", drv, "CharMin")
txt_max.DataBindings.Add("Text", drv, "CharMax")
bmb.Position = 0

I've verified that following the findrows drv contains 3 rows, so it's not
a
problem there, and if I bind directly to the dataview(dv) there's no
problem.

Can anyone please advise as to where I'm going wrong?

Many thanks for any help!

Niki
--
Niki Reid
DARD, Belfast

Nov 21 '05 #2
Bart

I've tried filtering which works fine but has a major performance hit (I'm
working in the compact framework). This looked just about perfect for what I
need - I'll just have to code something similar myself.

Thanks anyway,

Niki

"Bart Mermuys" wrote:
Is there any reason why you can't use the row filter and bind to the dv:
dv.RowFilter = "ReplicateID = 195"

You can not bind to array's because they don't implement IList or any other
usefull interfaces for binding, you can bind to a single DataRowView though.


Nov 21 '05 #3
Niki,

Than will your method give probably an even more performance hit.

Cor
Nov 21 '05 #4
>
Than will your method give probably an even more performance hit.

To explain that something more, you have to clone the datatable and than to
import the datarows which reflects the datarowview into that table.

You can use this sample (It is not exact the same). However I think the
method Bart told will give you more efficiency.

http://www.windowsformsdatagridhelp....7-d6ad9bebf57f

I hope this helps,

Cor
Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alpha | last post by:
I have a listbox with datasource from a dataview. When a user selects a different item in a combobox then I need to refresh the listbox to the appropriate listing based on that combobox's selected...
2
by: Dica | last post by:
i've got a table in my dataSet that looks like this: <tblTasks> <taskID>0</taskID> <projectID>0</projectID> <summary>-- Select A Task --</summary>
2
by: Alpha | last post by:
I have a window application. On one of the form, there is a listbox and a few combox. The lstSchItem has a dataview as a datasource. The comboxes are bind to its selected value but through the...
4
by: Greg Linwood | last post by:
I am wondering what the best approach to binding XML data to an asp:Table from the Page_Load event in a code behind module? I'm using VB.Net and initially approached this by adding a table to the...
7
by: Peter Afonin | last post by:
Hello, I have a code that queries Active Directory and put logins and names into the ArrayList. Then I need to bind this ArrayList to the DropdDownList, making names as DataTextField and logins...
5
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it...
1
by: Larry Bird | last post by:
I've successfully created a dataview that I want to passing to another subroutine. See Example below: Creation of dataview: For Each CriteriaDetailRow In...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
0
by: Rami Prilutsky | last post by:
I'm binding the dataView to a dataset (~400000 rows) and sorting it by a key (long type). I'm retrieving values from the DataView with FindRows(object key) which returns DataRowView. The...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.