﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » How do I...Return the selected record</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 07:38:13 GMT</lastBuildDate><ttl>20</ttl><item><title>How do I...Return the selected record</title><link>http://forum.strataframe.net/FindPost6418.aspx</link><description>Hello all,&lt;/P&gt;&lt;P&gt;Say I have an entry form with several fields that are related to lookup tables.&lt;/P&gt;&lt;P&gt;Entry Form&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Person Hair Color&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Person Eye Color&lt;/P&gt;&lt;P&gt;The hair and eye colors come from a lookup table.&amp;nbsp;&amp;nbsp; I want to present a browse list of available options, allow them to enter new categories, and return a single selected record back to the main entry form.&lt;/P&gt;&lt;P&gt;Is there an example on how to do this with StrataFrame?&lt;/P&gt;&lt;P&gt;Ben</description><pubDate>Tue, 30 Jan 2007 16:52:01 GMT</pubDate><dc:creator>Ben Kim</dc:creator></item><item><title>RE: How do I...Return the selected record</title><link>http://forum.strataframe.net/FindPost6444.aspx</link><description>In this example the best solution would be using a combo box and having the combo populate itself using the "BusinessObject" option.&amp;nbsp; There are a number of samples that show the advanced list population within StrataFrame.&amp;nbsp; You can see this in the Advanced ListView Population sample or the combo boxes in the sample CRM Application on the Customer Maintenance Form show this as well.&lt;/P&gt;&lt;P&gt;You can use the BrowseDialog, which there is a sample for the BrowseDialog as well, but in this case I would think a combo box would be the way to go.</description><pubDate>Tue, 30 Jan 2007 16:52:01 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: How do I...Return the selected record</title><link>http://forum.strataframe.net/FindPost6425.aspx</link><description>I'm sure there is a fancy SF way, but as I've not had the training (yet), I don't know it.&lt;br&gt;
&lt;br&gt;
However, just using normal .NET techniques is pretty easy.  Build your browse form with whatever functionality you want. I've done forms with tree views and with lists, both with associated editors for the selected item (i.e. they click on tree or list and BO navigates to associated item, there is an editing area, where they can edit/delete/add items (as makes sense)).&lt;br&gt;
&lt;br&gt;
Then just have a public property that returns whatever you need in the calling form. I usually return the PK of the browsed item. The key is that you can return information about the current row in the BO.  &lt;br&gt;
&lt;br&gt;
Public Property ItemPK() as Integer&lt;br&gt;
  Get &lt;br&gt;
   ' myBO is the BO on browse form, PkField is the strongly typed &lt;br&gt;
   ' property for the pk of the item in browse dialog&lt;br&gt;
    me.myBO.PkField&lt;br&gt;
  End Get&lt;br&gt;
End Property&lt;br&gt;
&lt;br&gt;
Lastly, you will want to have a cancel and OK button that return DialogResults of Cancel and OK respectively, which sets the dialog result and hides the form.&lt;br&gt;
&lt;br&gt;
Private Sub btnCancel_Click(sender as Object, e As EventArgs) Handles btnCancel.Click&lt;br&gt;
  Me.DialogResult = Windows.Forms.DialogResult.Cancel&lt;br&gt;
End Sub&lt;br&gt;
&lt;br&gt;
Private Sub btnOK_Click(sender as Object, e As EventArgs) Handles btnOK.Click&lt;br&gt;
  Me.DialogResult = Windows.Forms.DialogResult.OK&lt;br&gt;
End Sub&lt;br&gt;
&lt;br&gt;
The calling form uses a ShowDialog() and after the browse form closes, get the value from the property.&lt;br&gt;
&lt;br&gt;
Private Sub btnGetHairColor_Click(sender as Object, e As EventArgs) Handles btnGetHairColor.Click&lt;br&gt;
  Using frm as New HairColorForm()&lt;br&gt;
    frm.ShowDialog(Me)&lt;br&gt;
    If frm.DialogResult = Windows.Forms.DialogResult.OK Then&lt;br&gt;
      ' Set hair color here&lt;br&gt;
      dim hairColorPK as Integer = frm.ItemPK ' from property above&lt;br&gt;
    End If&lt;br&gt;
  End Using&lt;br&gt;
End Sub&lt;br&gt;</description><pubDate>Tue, 30 Jan 2007 12:15:02 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>