Solved

add search textbox to a VB datagrid then highlight the cell

Posted on 2007-12-06
5
1,791 Views
Last Modified: 2013-11-27
I want to have a text box with say a 'go' submit button that will search through my displayed datagrid (visual basic)  and display "not found" or if found the cell found is highlighted.
I am a begginer to VB
I am using PCstatusDataset, Workstaionbindingsource and workstationstableadaptor
i have imports system.data.sqlclient
the data grid is called workstationsdatagridview
the database is called pcstatus. The table is called workstations the two columns I wish to search through are called 'PC'  and 'Username'. and then the cursor moves to that cell that is found.

Thanks
steve

0
Comment
Question by:harveygs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20421341
is this a Windows app/ web app?
0
 
LVL 1

Author Comment

by:harveygs
ID: 20421578
windows application
0
 
LVL 21

Accepted Solution

by:
surajguptha earned 500 total points
ID: 20422450
Here's the pseudo code

        For index As Integer = 1 To DataGridView1.Rows.Count
            For index1 As Integer = 1 To DataGridView1.Rows(index).Cells.Count
                If (DataGridView1.Rows(index).Cells(index1).Value.ToString().Contains(searchString)) Then
                    DataGridView1.Rows(index).Cells(index1).Selected = True
                End If
            Next
        Next
0
 
LVL 1

Author Comment

by:harveygs
ID: 20431594
yes that worked fine thanks. I had to put -1 at the end because it went out of range.
0
 

Expert Comment

by:Carlo45
ID: 26194780
harveygs, can you post your code please..
0

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question