473,732 Members | 2,175 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 1205
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
3644
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
13351
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
2069
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
1909
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
1747
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
9445
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
9306
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
9234
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
9180
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
8186
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
6030
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
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
4805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2177
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.