473,698 Members | 2,451 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filtering a datagrid

Art
Hi,

Once again, I'm stuck.

I want to view a table using a DataGrid. I'd like to fiter that view by
criteria on various fields.

So far, I've created a DataAdapter, generated a DataSet and used that
DataSet as the DataSource for a DataGrid. I put a "fill" in my open form
event.
Me.OleDbDataAda pter1.Fill(Data Set11)

Then I tried a select statement:
Me.DataSet11.Co mpany.Select("I D=3", "ID", DataViewRowStat e.CurrentRows)

"Company" is the one and only table I selected when configuring the
DataAdapter.

The entire dataset shows up in my DataGrid. I can't seem to get it to filter.

Can anyone help?

Art
Nov 21 '05 #1
4 1202
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfil ter property to get your subset.

Chris

"Art" <Ar*@discussion s.microsoft.com > wrote in message
news:9B******** *************** ***********@mic rosoft.com...
Hi,

Once again, I'm stuck.

I want to view a table using a DataGrid. I'd like to fiter that view by
criteria on various fields.

So far, I've created a DataAdapter, generated a DataSet and used that
DataSet as the DataSource for a DataGrid. I put a "fill" in my open form
event.
Me.OleDbDataAda pter1.Fill(Data Set11)

Then I tried a select statement:
Me.DataSet11.Co mpany.Select("I D=3", "ID", DataViewRowStat e.CurrentRows)

"Company" is the one and only table I selected when configuring the
DataAdapter.

The entire dataset shows up in my DataGrid. I can't seem to get it to
filter.

Can anyone help?

Art

Nov 21 '05 #2
Art
Chris,

I will need to select criteria during run time. That is, I'll pick
something from a ComboBox and I'll want to make my DataGrid show me the
appropriate records. Can a DataView do this? I did read a little on it and
it sounded like it was something that had to be set up ahead of time.

Thanks for your help.

Art

"Chris, Master of All Things Insignifican" wrote:
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfil ter property to get your subset.

Chris

"Art" <Ar*@discussion s.microsoft.com > wrote in message
news:9B******** *************** ***********@mic rosoft.com...
Hi,

Once again, I'm stuck.

I want to view a table using a DataGrid. I'd like to fiter that view by
criteria on various fields.

So far, I've created a DataAdapter, generated a DataSet and used that
DataSet as the DataSource for a DataGrid. I put a "fill" in my open form
event.
Me.OleDbDataAda pter1.Fill(Data Set11)

Then I tried a select statement:
Me.DataSet11.Co mpany.Select("I D=3", "ID", DataViewRowStat e.CurrentRows)

"Company" is the one and only table I selected when configuring the
DataAdapter.

The entire dataset shows up in my DataGrid. I can't seem to get it to
filter.

Can anyone help?

Art


Nov 21 '05 #3
nope. it's all runtime. This is an example that I wrote in here but didn't
test but the idea will be there

Me.OleDbDataAda pter1.Fill(Data Set11)
DataSet11.Table (0).DefaultView .RowFilter = "ColumnName = FilterValue"
DataGrid1.DataS ource = DataSet11.Table (0).DefaultView

That should work. The RowFilter property is basically a where clause of a
SQL statment. You can create a DataView object instead of using the
defaultview from the datatable if you want.

Me.OleDbDataAda pter1.Fill(Data Set11)
Dim DV as DataView
DV = DataSet11.Table (0).DefaultView
DV.RowFilter = .RowFilter = "ColumnName = FilterValue"
DataGrid1.DataS ource = DV

Hope it helps
Chris

"Art" <Ar*@discussion s.microsoft.com > wrote in message
news:37******** *************** ***********@mic rosoft.com...
Chris,

I will need to select criteria during run time. That is, I'll pick
something from a ComboBox and I'll want to make my DataGrid show me the
appropriate records. Can a DataView do this? I did read a little on it
and
it sounded like it was something that had to be set up ahead of time.

Thanks for your help.

Art

"Chris, Master of All Things Insignifican" wrote:
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfil ter property to get your subset.

Chris

"Art" <Ar*@discussion s.microsoft.com > wrote in message
news:9B******** *************** ***********@mic rosoft.com...
> Hi,
>
> Once again, I'm stuck.
>
> I want to view a table using a DataGrid. I'd like to fiter that view
> by
> criteria on various fields.
>
> So far, I've created a DataAdapter, generated a DataSet and used that
> DataSet as the DataSource for a DataGrid. I put a "fill" in my open
> form
> event.
> Me.OleDbDataAda pter1.Fill(Data Set11)
>
> Then I tried a select statement:
> Me.DataSet11.Co mpany.Select("I D=3", "ID",
> DataViewRowStat e.CurrentRows)
>
> "Company" is the one and only table I selected when configuring the
> DataAdapter.
>
> The entire dataset shows up in my DataGrid. I can't seem to get it to
> filter.
>
> Can anyone help?
>
> Art


Nov 21 '05 #4
Art
Chris,

Works GREAT!! Thanks!

Art

"Chris, Master of All Things Insignifican" wrote:
nope. it's all runtime. This is an example that I wrote in here but didn't
test but the idea will be there

Me.OleDbDataAda pter1.Fill(Data Set11)
DataSet11.Table (0).DefaultView .RowFilter = "ColumnName = FilterValue"
DataGrid1.DataS ource = DataSet11.Table (0).DefaultView

That should work. The RowFilter property is basically a where clause of a
SQL statment. You can create a DataView object instead of using the
defaultview from the datatable if you want.

Me.OleDbDataAda pter1.Fill(Data Set11)
Dim DV as DataView
DV = DataSet11.Table (0).DefaultView
DV.RowFilter = .RowFilter = "ColumnName = FilterValue"
DataGrid1.DataS ource = DV

Hope it helps
Chris

"Art" <Ar*@discussion s.microsoft.com > wrote in message
news:37******** *************** ***********@mic rosoft.com...
Chris,

I will need to select criteria during run time. That is, I'll pick
something from a ComboBox and I'll want to make my DataGrid show me the
appropriate records. Can a DataView do this? I did read a little on it
and
it sounded like it was something that had to be set up ahead of time.

Thanks for your help.

Art

"Chris, Master of All Things Insignifican" wrote:
Try using a dataview to filter the events. Then bind the dataview to the
datasource. Set the DataView.Rowfil ter property to get your subset.

Chris

"Art" <Ar*@discussion s.microsoft.com > wrote in message
news:9B******** *************** ***********@mic rosoft.com...
> Hi,
>
> Once again, I'm stuck.
>
> I want to view a table using a DataGrid. I'd like to fiter that view
> by
> criteria on various fields.
>
> So far, I've created a DataAdapter, generated a DataSet and used that
> DataSet as the DataSource for a DataGrid. I put a "fill" in my open
> form
> event.
> Me.OleDbDataAda pter1.Fill(Data Set11)
>
> Then I tried a select statement:
> Me.DataSet11.Co mpany.Select("I D=3", "ID",
> DataViewRowStat e.CurrentRows)
>
> "Company" is the one and only table I selected when configuring the
> DataAdapter.
>
> The entire dataset shows up in my DataGrid. I can't seem to get it to
> filter.
>
> Can anyone help?
>
> Art


Nov 21 '05 #5

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

Similar topics

0
3640
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
10
13343
by: milk-jam | last post by:
I'm trying to set my datagridview so that the first row will be left blank and to use it as a filtering filed for the datagridview. Until now I was using 2 datagridview the upper one with a header that sort and one row for filtering and the lower one with no header for the data. Only it is very complicated to work this way cause for example when the user click on sort on the upper datagridview I need to sort the lower grid and so on when...
2
2068
by: Gummy | last post by:
Hello All, I have a webpage that has two dropdown listboxes. Based on what is selected in these dropdown listboxes, it filters a DataGrid . That works fine. In the DataGrid , when I go to edit a row, I change the textbox (or other control), click Update, but it doesn't save my data. I then did this... In Page_Load, I added code to filter the DataGrid only when it was Not Page.IsPostBack. Then the editing/updating of the DataGrid data...
5
1908
by: LDD | last post by:
Hi Folks I'm trying to determine a way to handle paging, filtering and sorting in a datagrid. If I choose to filter and sort, I'd like to return a subset. If that resultset has more records then the number of rows I'd like to display, I'd like to be able to load pages into the grid. My question is, do I need to continually hit the db to get the next page of records, or is there another method of doing with the dataset. i.e. load the
2
1745
by: jvdub22 | last post by:
I have a vb.net windows form application that has two datagrids on it that have a master - detail relationship. The underlying database is an sql database. The application works fine when I first load the application and query all records. My question is how can I add filtering too my master grid? I would like the user to be able to filter records in the master table and keep the relationship with the detail table. If I use a dataview to do...
0
8676
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
8608
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
9161
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
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...
1
8897
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8867
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7732
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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

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.