Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to display a lookup value in Winform textbox?
Message
From
12/04/2005 18:37:05
 
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01003915
Message ID:
01003993
Views:
18
Larry,

You're on the right track. As far as how to determine CurrentRow, you didn't say how you're navigating the dtOrderDetail ... is this table used to populate a Grid? Or are you navigating by other means? In any case, you will need to mess with the BindingContext to get the current position. Also, you need a few extra quotes to specify the RowFilter correctly. I hope my VB syntax is accurate:
CurrentRow = Me.BindingContext(dtOrderDetail).Position
dvProducts.RowFilter = "ProductID = '" + dtOrderDetail.Rows(CurrentRow)('ProductID') + "'"
You will need to put this code in whatever event handles the row changes (this depends on what you're using for navigation).

Does this help?

~~Bonnie



>Bonnie,
>
>Thank you for the quick reply. I had been working with the RowFilter this morning and can't quite get it working. I've read all the documentation I can find, and all the examples show a static RowFilter such as "ProductID = 3".
>
>How exactly would I write the RowFilter string within the dvProducts DataView to refer to the current (changing) value of the ProductID column in the dtOrderDetail table as it is navigated? It would be something like this:
>
>
>dvProducts.RowFilter = "ProductID = dtOrderDetail.Rows(CurrentRow)('ProductID')"
>
>
>but I'm not sure how to specify the CurrentRow (probably have to look further into BindingContext).
>
>Also, I'm assuming I set this up in the Form's constructor, but just confirming it. Finally, do I have to explicitly refresh the dvProducts or rebind it to the text box each time the OrderDetails table is navigated?
>
>My apologies for piling on questions but they are due to the spotty knowledge of .NET I have at this point. A code snippet would be very helpful.
>
>TIA,
>
>Larry
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform