473,388 Members | 1,493 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,388 software developers and data experts.

Searching Datagridview by typing in TextBox

173 100+
Afternoon,

i have a datagridview called 'gvStudents' that shows typical student info. I'm fairly new to VB.net and would like some clarity on how to search a datagridview by typing in a textbox.

As the user types in the textbox the results are shown in the datagridview to the closest match.

My gvStudents extracts info from my SQL 2005 database using a stored procedure. Ive connected to the database with a manual connection.

instead of making the textbox search the database using stored procedure i would like to extract the datagridview into a datatable (not sure if that makes sense) and run the search.

the code i'm trying to use and dont really understand to be fair is:

Expand|Select|Wrap|Line Numbers
  1. Dim dt As Table = Ctype(gvStudents.datasource,datatable)
  2.  
  3. for each row As datarow In dt.row Next 
  4.  
  5. if datarow.item("username.string.contains.Me.textbox.text)
  6.  
  7. datarow.visible = false
I know for a fact that some of this code is incorrect, missing and code needs adding. This is where i need your help. Can you please help me correct and complete this code? and explaining in very basics terms in how this code works?

sorry if my question or explanation is confusing.


Many thanks
Jan 9 '12 #1
0 1344

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Chris Strug | last post by:
Hi, As a learning exercise I have created a simple form which contains a DataGridView, a Textbox and a Command Button. The DGW is populated from a stored procedure which optionally takes a...
8
by: George | last post by:
Hi, I have been trying to see if I can do the following: 1. Create a DataGridView 2. Create 2 columns in the DataGridView (1 textbox and the other combobox) 3. Create a DataTable containing...
2
by: Scotty | last post by:
Hi, I am a beginner, like to working with ado net I have a datagridview If i selecting a row in the datagrid i want to have returning the selected data into a textbox "name" for example ...
1
by: =?Utf-8?B?VkJB?= | last post by:
Hi Well what i'm trying to do is search text in a datagridview, i've seen similar code around in other posts or forums, i'm implementing this by using a Textbox, and the code in the TextChanged...
3
by: Przemek M. Zawada | last post by:
Dear Group, I'm developing sample window form, using DataGridView control, which is filled with data through BindingSource, which is based on type of object, as follow: public sampleClass {...
1
by: sunnydoon | last post by:
hi everybody, i m new in asp and first time posting my prob to any community, My prob is that, Is there any option in asp, as we type the letters in dropdown it select acording to that like, ...
2
by: md110 | last post by:
how to AutoComlpate cell in datagridview
1
by: Andrus | last post by:
I need to create WinForms DataGridView column which shows spaces between thousands. I have found that MaskedTextBox Mask property supports this I tried to add column to DataGridView using ...
3
by: buterfly0707 | last post by:
i want to get multiple values from datagridview to same textbox and i want to seperate those values from commas. and my datagridview in one form and the textbox in another form.
0
by: joeandtel | last post by:
I have a DataGridView that has a column which has been set to a textbox. Everytime I save the DataGridView values I stored that column in a text file. I want to be able to read from the text file...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.