473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

problem binding filtered dataview to listbox

s
I'm able to get the count of the filtered rows of the dataview from within
the With view block, but when I try to bind the view to the listbox I don't
get any count within the With lb1 block and my listbox is empty. What's wrong?

Dim view As New DataView(tbl)
With view
.AllowDelete = True
.AllowEdit = True
.RowFilter = "name like '" & cb1.Text & "%'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
End With
Try
With lb1
.DataSource = view
.DisplayMember = "name"
.ValueMember = "id"
End With

Dec 15 '05 #1
4 3310
S,

How do you get that count? (Are you sure that it is not the table property).

Not important, however, why you set the binding in a try block, there cannot
be any catcheble exception be catched in that?

Cor

"s" <s@discussions.microsoft.com> schreef in bericht
news:46**********************************@microsof t.com...
I'm able to get the count of the filtered rows of the dataview from within
the With view block, but when I try to bind the view to the listbox I
don't
get any count within the With lb1 block and my listbox is empty. What's
wrong?

Dim view As New DataView(tbl)
With view
.AllowDelete = True
.AllowEdit = True
.RowFilter = "name like '" & cb1.Text & "%'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
End With
Try
With lb1
.DataSource = view
.DisplayMember = "name"
.ValueMember = "id"
End With

Dec 16 '05 #2
wd
I set a breakpoint in the first block and open up the command window to do
"? view.count" but when I'm in the second block the lb1 returns zero count.
The try block is a remnant of older code that I had modified but left the
try there.


"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eR**************@TK2MSFTNGP14.phx.gbl...
S,

How do you get that count? (Are you sure that it is not the table property).
Not important, however, why you set the binding in a try block, there cannot be any catcheble exception be catched in that?

Cor

"s" <s@discussions.microsoft.com> schreef in bericht
news:46**********************************@microsof t.com...
I'm able to get the count of the filtered rows of the dataview from within the With view block, but when I try to bind the view to the listbox I
don't
get any count within the With lb1 block and my listbox is empty. What's
wrong?

Dim view As New DataView(tbl)
With view
.AllowDelete = True
.AllowEdit = True
.RowFilter = "name like '" & cb1.Text & "%'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
End With
Try
With lb1
.DataSource = view
.DisplayMember = "name"
.ValueMember = "id"
End With


Dec 16 '05 #3
Wd,

Did you ever use a right click on the item name, than quick watch, I have
more trust in that one.

As the code in the second part is, beside that try catch, is it should be
in my opinion right if there are rows in the dataview.

Cor
Dec 16 '05 #4
s
I checked out the watch and it shows a value of 16 for the
DataViewRowState.ModifiedCurrent in the view block, but inside the lb1 block
if I check the count for view it is 0. I don't understand what's wrong. I
cleaned up the code and tried to again but still doesn't help:

Dim view As New DataView(tbl)
With view
.AllowDelete = True
.AllowEdit = True
.RowFilter = "name like '" & cb1.Text & "%'"
.RowStateFilter = DataViewRowState.ModifiedCurrent
End With
With lb1
.DataSource = view
.DisplayMember = "name"
.ValueMember = "id"
End With


"Cor Ligthert [MVP]" wrote:
Wd,

Did you ever use a right click on the item name, than quick watch, I have
more trust in that one.

As the code in the second part is, beside that try catch, is it should be
in my opinion right if there are rows in the dataview.

Cor

Dec 22 '05 #5

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

Similar topics

0
by: RPI_alum | last post by:
I've been experiencing some frustrating behavior that I believe may be a MS bug in the Framework. Has anyone else experienced this, know a better way to resolve it, or if it is an actual MS bug ...
5
by: Jim Heimer | last post by:
When I use the dataview.rowfilter and I try to display the field value of the first row, the code doesn't seem to show the first row AFTER the rowfilter. This is my code: DataView...
1
by: Tomek Kmiecik | last post by:
Hello! I'm writing simple database application. One table in the database stores some information about keywords (among other, keyword name, id number and description). Description is stored in...
1
by: Tim | last post by:
Hi I am implementing some printing in C# and I need to get the data for it. I am using a datagrid. I can sort the data and filter it. I want to get a datatable of only the data visible in the...
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...
3
by: Eric Lemmon | last post by:
Greetings, I have a VB.NET Windows app where I bind a listbox to a DataView column that contains date values. In this list, however, only the date (not the time) is relavent, so I want to...
3
by: amber | last post by:
I have a listview (lstvwAmend) (containing 2 columns) that is populated by a filtered dataview (dvRPA) that is based on a dataset (dsRPAmend1) pulling data from a SQL Server database This dataview...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
3
by: csharpula csharp | last post by:
Hello, I am trying to do data binding with c# Binding - trying to bind list<objectto a list view. Is there any code example for doing that? Thank you! *** Sent via Developersdex...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.