Solved

add search textbox to a VB datagrid then highlight the cell

Posted on 2007-12-06
5
1,790 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

730 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