[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

add search textbox to a VB datagrid then highlight the cell

Posted on 2007-12-06
5
Medium Priority
?
1,796 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
  • 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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 …
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

829 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