?
Solved

selecting un-used items only

Posted on 2012-04-12
4
Medium Priority
?
220 Views
Last Modified: 2012-04-20
Hi All,

I have two datagridviews in a parent child relationship.
The child datagridview that has a combo box column bound to a dataset that fills up the column(called it column A) with values -basically it picks the value name from the master record(for example value currencyid -its master record has the currency name which user can easily identify-*thats just an example of the concept)

I want to be able to:
(1)select the parent row and in the child datagridview, have column A be filled with the correct values for each child row.
(2)when i want to add a new child row,column A only populate with records not previously used.(actualy am using a view to check if the value in A has a balance or not and i want to populate only those with balances)

The problem is that when I use a select statement that filters so as to get point (2), databinding is not possible (point 1)

How do I resolve this so that when a user starts a new child row they get only the filtered data -and not affect the earlier data which is databound?
0
Comment
Question by:NormanMaina
[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
4 Comments
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37839338
>The problem is that when I use a select statement that filters

Show us the code that you have tried
0
 
LVL 12

Author Comment

by:NormanMaina
ID: 37841237
CodeCruiser>I have an sql view that displays unit balances for each item...to filter i CAN just use 'where balance>0' in the table adaptor query and have it in the form load event.(this causes a problem with existing data because it is filtered out)

What I want to acheive,is only when the datagridview combobox column is expanded -to use the view and filter where balances are zero -but otherwise when loading the form to load all data.


I hope that is clearer......

The objective is to minimize on errors of wrongful entry when a user tries to save an entry that has zero balances and to make the combobox dropdown have fewer values that are current.

I could implement the same from the Save button -to validate if the unit has zero balances BUT that will not resolve having a datagridview combobox with thousands of items where you only need to select one.

What I could do in this case is filter he units being populated in the grid column by the date range they were entered......

Is there another way of doing -a more elegant way paharps?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 37866885
You can try following links and see if you can piece together something

http://www.daniweb.com/software-development/csharp/threads/179417/datagridview-populate-combobox-for-each-row

http://www.vbdotnetforums.com/winforms-grids/10038-fill-datagridview-combobox-column.html


Another option would be to use a standard column instead of combobox column but change it to combobox when user wants to edit it

http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.editingcontrolshowing.aspx
0
 
LVL 12

Author Closing Comment

by:NormanMaina
ID: 37874829
I like the second option much better.Thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

752 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