Solved

How to select a single row from a dataset table

Posted on 2013-06-13
3
516 Views
Last Modified: 2013-06-14
I have a dataset table bound to a couple of text boxes.    I have a find button a a list of residents come up.  When the user double clicks the row on the grid I caputre that rows ID #.  I then want to take the dataset table I have and and go the the record of the ID.  I am using a bindingsource object, and I know I can use bs.position to get current position but how do I find the record with the ID selected and then make that the currently selected row.

thanks in advance
0
Comment
Question by:mgmhicks
3 Comments
 
LVL 13

Expert Comment

by:Jesus Rodriguez
Comment Utility
Why don't you bind the controls to the same bindingsource of the grid and will be easy for you.
Also, did you have a bindingnavigator or bindingsource for the textboxes or you fill the textboxes directly from your dataset on a sub??
0
 

Author Comment

by:mgmhicks
Comment Utility
the textboxes are bound first.  I am using a bindingsource to do that so I can use bs.position + 1 and the textboxes fill with the next record.  However when the click the find button, they get a grid, bound to different source, but selects the ID.  ONce I have the ID I want to go the that record in the bs that matches the ID selected.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
Comment Utility
You can try 2 things

1) Use filter property and set a filter on ID. This would mean there is only one row and that will be shown
http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.filter.aspx

2) Set Position property to index of row in grid and see if the two match
http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingsource.position.aspx
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now