473,769 Members | 2,091 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 = DataViewRowStat e.ModifiedCurre nt
End With
Try
With lb1
.DataSource = view
.DisplayMember = "name"
.ValueMember = "id"
End With

Dec 15 '05 #1
4 3335
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******** *************** ***********@mic rosoft.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 = DataViewRowStat e.ModifiedCurre nt
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******** ******@TK2MSFTN GP14.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******** *************** ***********@mic rosoft.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 = DataViewRowStat e.ModifiedCurre nt
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
DataViewRowStat e.ModifiedCurre nt 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 = DataViewRowStat e.ModifiedCurre nt
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
1586
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 *) I have a DataSet containing 2 tables, A and B *) There is a 1-to-1 relation between the tables with table A being the parent. (ABrel *) A DataView is created on table A to allow filtering of the result se *) 2 Text Boxes are created and Bound...
5
15819
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 DataView_Filter = new DataView(); DataView_Filter.Table = DS_States.Tables; sFilter = "Emplcode = '123233'"; DataView_Filter.RowFilter = sFilter; MessageBox.Show (DataView_Filter.Count.ToString()); //it displays 6
1
2814
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 rtf format. Following code is responsible for data binding (lstKeywords is ListBox,rtbDescription is RichTextBox): lstKeywords.DataSource = manager.KeywordsDataView;
1
1541
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 datagrid. The underlying dataview holds all the records. If I have a dataview with 80 records in but the user does a filter in the datagrid, I want to get only the 5 filtered records. Can anyone help me with this one?
6
12920
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 value which is included in the listbox's filtering statement. Is the only way to do this is to dispose the dataview and then create a new one and then bind it to the listbox? Is there a better way than this? Thanks, Alpha
3
1907
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 eliminate the time. As an example, SQL Server returns: 2004-04-18 00:00:00.000. Instead, I want: 4/18/2004. Is there a way to alter the format in which the DataView displays a table's rows without having to alter data source? As a (hopefully)...
3
2230
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 will contain 0-10 records. The dataview is displaying field 1 & field 2 from my dataview When a user clicks on one of the items in the listview, I want to set the value of a textbox on my form to equal field 3 from the same row in my dataview I...
8
3927
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 addition fields. I'm able to get the datagrid to be properly populate with only the child records relating to the specified parent by setting the ..DefaultView.RowFilter property. Currently, to properly add a new child record, I need to manually...
3
454
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 http://www.developersdex.com ***
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10038
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8867
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5294
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3558
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.