Solved

How to select a single row from a dataset table

Posted on 2013-06-13
3
522 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
[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
3 Comments
 
LVL 13

Expert Comment

by:Jesus Rodriguez
ID: 39245418
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
ID: 39245626
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
ID: 39247138
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 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