﻿<?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?)  » NavigateToPrimaryKey Error</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 10 Sep 2026 06:50:46 GMT</lastBuildDate><ttl>20</ttl><item><title>NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15006.aspx</link><description>1) PrimaryBusinessObject: tbCadastroBO1&lt;/P&gt;&lt;P&gt;2) browseDialog1-&amp;gt;BusinessObjectType: vwTbCadastroBO&lt;BR&gt;&amp;nbsp;&amp;nbsp; browseDialog1-&amp;gt;BusinessObjectToPopulate: vwTbCadastroBO1&lt;/P&gt;&lt;P&gt;3) After executed the search: Procedure executed inside of the event of closing of the browseDialog1 control.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void browseDialog1_BrowseDialogClosed(EventArgs e)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (vwTbCadastroBO1.Count == 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int idCadastro = vwTbCadastroBO1.IdCadastro;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tbCadastroBO1.FillByView(vwTbCadastroBO1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (tbCadastroBO1.Count &amp;gt; 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.NavigateToPrimaryKey(idCadastro);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;4) Method to populate the Primary Business Object (tbCadastroBO1) from the loaded view BO (vwTbCadastroBO1) in the browseDialog.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void FillByView(BDLicitecMasterViewBO.vwTbCadastroBO viewBO)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (viewBO.Count == 0)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; viewBO.MoveFirst();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string where = string.Empty;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where += viewBO.IdCadastro + ", ";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } while (viewBO.MoveNext());&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = where.Trim();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where = where.Remove(where.Length - 1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.FillDataTable("SELECT * FROM TbCadastro"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; + " WHERE IdCadastro IN ( " + where + " )");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;BR&gt;5) Error: The navigation is executed successfully, however, the controls in the form is not refreshed.</description><pubDate>Thu, 20 Mar 2008 13:08:18 GMT</pubDate><dc:creator>Rogerio Mauri</dc:creator></item><item><title>RE: NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15072.aspx</link><description>Yeah, you do have to have a primary key so that makes sense.&amp;nbsp; Glad you found the problem. :)</description><pubDate>Thu, 20 Mar 2008 13:08:18 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15068.aspx</link><description>Trent...&lt;P&gt;Solved problem!&lt;/P&gt;&lt;P&gt;Step by step:&lt;/P&gt;&lt;P&gt;Considering that vwTbCadastroBO1 is an object constructed from a view, it does not have primary key. Then, in the "Business Object Mapper" I configured "Override Primary Key Specification" with the IdCadastro field. ... soon easy...&lt;/P&gt;&lt;P&gt;Of fact the problem occurred because the primary key of the BO was not defined. (the vwTbCadastroBO has its origin in one view in the database).&lt;/P&gt;&lt;P&gt;I wait that my English for AltaVista translator has been intelligible.&lt;/P&gt;&lt;P&gt;Thank you very much :D :D :D</description><pubDate>Thu, 20 Mar 2008 11:32:44 GMT</pubDate><dc:creator>Rogerio Mauri</dc:creator></item><item><title>RE: NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15064.aspx</link><description>Rogerio,&lt;/P&gt;&lt;P&gt;I am sorry, but I think that there is some other logic in your form or BOs that could be having an impact on the results you are seeing.&amp;nbsp; I have really tried to reproduce this trying both the double-click and clicking the OK.&amp;nbsp; Everything in our medical application, CRM system, and the samples I have created all work correctly.&amp;nbsp; I cannot reproduce this. Could you give me a sample and a stack trace?&amp;nbsp; I really want to help you find your problem here...but I just can't find it with the information you have given me so far....sorry :ermm:</description><pubDate>Thu, 20 Mar 2008 09:53:36 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15048.aspx</link><description>When I select the register and I choose button OK, the fields are brought up to date. (NavigateToPrimaryKey =&amp;gt; OK)&lt;P&gt;However, when I select the register and I give a double click in the grid, the form closes, but it does not bring up to date the fields. (NavigateToPrimaryKey =&amp;gt; it does not execute)&lt;BR&gt;&amp;nbsp;&lt;BR&gt;I believe that the error is in this point of the function.&lt;/P&gt;&lt;P&gt;Namespace UI.Windows.Forms&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;DefaultEvent("RowPopulating")&amp;gt; _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ToolboxBitmap(GetType(IconFinder), "BrowseDialog.bmp")&amp;gt; _&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Class BrowseDialog&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Class BrowseDialog&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..... &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Overridable Function ShowDialog(ByVal PopulateOnShow As Boolean, ByVal ResultsWindowOwner As IWin32Window) As DialogResult&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Refresh the bound controls&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If lnReturn = DialogResult.OK Then&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;&lt;FONT color=#dd3333&gt;If loForm.SelectedPrimaryKey Is Nothing Then&lt;/FONT&gt;&lt;/STRONG&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#119911&gt;Me._BusinessObject.Navigate(BusinessNavigationDirection.First):exclamation:&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me._BusinessObject.NavigateToPrimaryKey(CType(loForm.SelectedPrimaryKey, PrimaryKeyValue).GetValues())&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Indicate that the end-user clocked the OK button&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loCloseReason = BrowseDialogClosedReasons.UserSelectedResult&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; loCloseReason = BrowseDialogClosedReasons.UserCancelled&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Class&lt;/P&gt;&lt;P&gt;End Namespace&lt;BR&gt;</description><pubDate>Wed, 19 Mar 2008 20:22:39 GMT</pubDate><dc:creator>Rogerio Mauri</dc:creator></item><item><title>RE: NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15017.aspx</link><description>Well, I see a couple of things that could be suspect.&amp;nbsp; First, you are calling a NavigateToPrimaryKey on the BrowseClosed event, which you can do, but you will need to be careful if you are navigating on the BO that was just updated by the BrowseDialog.&lt;/P&gt;&lt;P&gt;From just looking at the code you posted I do not see exactly where it could be failing....but I do see a few "red flags."&amp;nbsp; If you would like, create a sample that reproduces the problem and I will take a look at it.&amp;nbsp; But I am pretty condifent that your application code may be working against the BrowseDialog and NavigateToPrimary key logic presenting the error (which a stack trace would be more helpful than the code posted above).&amp;nbsp; Anytime that you get an error, a stack trace does a lot more for us in trying to diagnose a problem. :)</description><pubDate>Wed, 19 Mar 2008 09:42:51 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: NavigateToPrimaryKey Error</title><link>http://forum.strataframe.net/FindPost15007.aspx</link><description>PS: The navigation method returns true.</description><pubDate>Tue, 18 Mar 2008 23:15:48 GMT</pubDate><dc:creator>Rogerio Mauri</dc:creator></item></channel></rss>