473,540 Members | 9,458 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filter on Datagridview

I have a datagridview on a form and It has two columns which are
comboboxes. The columns are use for showing name, lastname.

The columns are bound to a database table. I want to do this:
Suppose there are these information in the DB:
Name: LastName:
----------------------------------
John Smith
John Black
Alen Young
Now If the user selects John for name the last name would be showing
Smith and black. I mean I want to filter a column based

on another.
Can anyone please help?

Oct 22 '07 #1
4 6354
On Oct 23, 12:31 pm, shahoo <shahookaman...@gmail.comwrote:
I have a datagridview on a form and It has two columns which are
comboboxes. The columns are use for showing name, lastname.

The columns are bound to a database table. I want to do this:
Suppose there are these information in the DB:
Name: LastName:
----------------------------------
John Smith
John Black
Alen Young
Now If the user selects John for name the last name would be showing
Smith and black. I mean I want to filter a column based

on another.
Can anyone please help?
hope this helps

((DataTable)this.datagrid1.DataSource).DefaultView .RowFilter = "Name =
" + combobox.selectedtext

cheers
sunny
Oct 23 '07 #2
hope this helps
>
((DataTable)this.datagrid1.DataSource).DefaultView .RowFilter = "Name =
" + combobox.selectedtext

cheers
sunny
Thanks for the help. I solved it using something based on your way.
Now I have another problem.
I want the filtered row to show Distinct values. How can I do that?

Oct 29 '07 #3
On Oct 30, 9:57 am, shahoo <shahookaman...@gmail.comwrote:
hope this helps
((DataTable)this.datagrid1.DataSource).DefaultView .RowFilter = "Name =
" + combobox.selectedtext
cheers
sunny

Thanks for the help. I solved it using something based on your way.
Now I have another problem.
I want the filtered row to show Distinct values. How can I do that?
explain in detail please!!! give an example

Oct 31 '07 #4
On Oct 31, 3:58 am, sunny <furyunlimi...@gmail.comwrote:
On Oct 30, 9:57 am, shahoo <shahookaman...@gmail.comwrote:
hope this helps
((DataTable)this.datagrid1.DataSource).DefaultView .RowFilter = "Name =
" + combobox.selectedtext
cheers
sunny
Thanks for the help. I solved it using something based on your way.
Now I have another problem.
I want the filtered row to show Distinct values. How can I do that?

explain in detail please!!! give an example
Fir example if there are these values in the table:
name: lastName: SSN
-----------------------------------------------------------
John Smith 1212
John Smith 112
Alen Young 232

and when the user selectes John for the name the combo box shows two
"Smith" values in it's dropdown list but I want to show only one
"Smith" not two.

Oct 31 '07 #5

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

Similar topics

1
6739
by: Job Lot | last post by:
How can I filter/search records in DataGridView after filling it with data? The BindingNavigator provides default functionality for navigating, adding, deleting and saving records. Is there anything available for filtering/searching records? Is there any Filter Bar available in DataGridView control similar Component One True DBGrid control? ...
3
7601
by: mafandon | last post by:
Is there a way to perform a bindingsource.filter on multiple inputs? For example: I would like the user to be able to put something like <Smith, Jones, Gates> into a textbox and have the datagridview filter the lastname column to just those entries. My code is simple right now: dim strFilterLastName as string = me.txtbxLastName.text ...
1
6795
by: martin1 | last post by:
Hi, All, DataGridView is populated with all coumns from database since i need some columns data for condition statement, after that I want to show rest of column in the DataGridView, so how to filter DataGridView column in order to show whatever column i want? Thanks
2
1277
by: Mohanss | last post by:
how filter options set in datagridview column in vb.net
0
1054
by: Mohanss | last post by:
how to filter the particular filed in datagridview at runtime in vb formns
2
4608
by: Paul | last post by:
Hi all, I have a DataTable and a DataGridView that is using it as a datasource. I'm using the DataTable.Select method and I can find some rows. Is it now possible, somehow to use the result of the Select method (a DataRow collection) to make the DataGridView filtering only on those rows? I mean to display only the found rows and after that to...
4
1270
nev
by: nev | last post by:
How do I filter a DataGridView with data that was entered programatically. I would like to achieve something like dgv.sort... but, dgv.filter does not exist.
0
1083
by: SAM | last post by:
Hi All, i work in project(vb) i deploy a table to DataGridView. and i try to Filter the Datagridview with the combination of 4 combobox. my problem i can't do that for the 4 combobox in same time. it work only for one at the time. any idea how i can do that'. Thank you.
0
2926
by: Proogeren | last post by:
I have made a service that sends a datatable with person information to a client. In the forms init event I call the service to retreive all persons from my service and displays them in a datagridview. In the form I want to be able to filter on e.g. first name. I have used the select method to filter on the datatable but it only returns...
0
7369
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...
0
7544
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. ...
0
7708
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...
1
7303
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...
0
5840
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...
1
5229
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3365
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...
1
1777
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
1
936
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.