<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Programmatically selecting a row</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Report Control : Programmatically selecting a row]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 02 May 2026 00:29:47 +0000</pubDate>
  <lastBuildDate>Fri, 03 Feb 2006 11:48:43 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=3591</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Programmatically selecting a row : Maybe you can first delete the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10797&amp;title=programmatically-selecting-a-row#10797</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 03 February 2006 at 11:48am<br /><br />Maybe you can first delete the record from your database, then after the delete is finished you can delete it from the ReportControl.]]>
   </description>
   <pubDate>Fri, 03 Feb 2006 11:48:43 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10797&amp;title=programmatically-selecting-a-row#10797</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : This works great if the user has...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10786&amp;title=programmatically-selecting-a-row#10786</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1670">John31</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 3:33pm<br /><br /><P>This works great if the user has not selected another record between delete and the server reply</P><P>&nbsp;</P><P>' get the current top row to use later<BR>lTopIndex = RC1.TopRowIndex<BR>' set the last index to highest possible value<BR>lLastIndex = RC1.Rows.Count<BR>' check to see how many rows are selected<BR>If RC1.SelectedRows.Count = 1 Then<BR>&nbsp;&nbsp;&nbsp; If RC1.SelectedRows(0).GroupRow Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' loop through all child rows for this group<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For Each oRow In RC1.SelectedRows(0).Childs<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ' make sure the recid is one that actually got deleted<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; If InStr(1, sRecID, oRow.Record.Item(COL_RECID).Value) Then<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' adjust the last row index if needed<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If oRow.Index &lt; lLastIndex Then lLastIndex = oRow.Index<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' remove the record<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RC1.Records.RemoveAt oRow.Record.Index<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; End If<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<BR>&nbsp;&nbsp;&nbsp; Else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' since this is a single row just set and delete<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set oRow = RC1.SelectedRows(0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' make sure the recid is one that actually got deleted<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If InStr(1, sRecID, oRow.Record.Item(COL_RECID).Value) Then<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ' adjust the last row index if needed<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; If oRow.Index &lt; lLastIndex Then lLastIndex = oRow.Index<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ' remove the record<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; RC1.Records.RemoveAt oRow.Record.Index<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp; End If<BR>Else<BR>&nbsp;&nbsp;&nbsp; ' loop through all selected records<BR>&nbsp;&nbsp;&nbsp; For Each oRow In RC1.SelectedRows<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' make sure the recid is one that actually got deleted<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If InStr(1, sRecID, oRow.Record.Item(COL_RECID).Value) Then<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ' adjust the last row index if needed<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; If oRow.Index &lt; lLastIndex Then lLastIndex = oRow.Index<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; ' remove the record<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; RC1.Records.RemoveAt oRow.Record.Index<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<BR>&nbsp;&nbsp;&nbsp; Next<BR>End If<BR>' repopulate the control<BR>RC1.Populate<BR>' set the top index back to what it was<BR>RC1.TopRowIndex = lTopIndex<BR>' correct the last index as needed<BR>If lLastIndex &gt; RC1.Rows.Count Then<BR>&nbsp;&nbsp;&nbsp; lLastIndex = RC1.Rows.Count - 1<BR>ElseIf lLastIndex &gt; 1 Then<BR>&nbsp;&nbsp;&nbsp; lLastIndex = lLastIndex - 1<BR>End If<BR>' get the row we want to set focus on<BR>Set oNextRow = RC1.Rows(lLastIndex)<BR>' make sure it exists and set focus<BR>If Not oNextRow Is Nothing Then Set RC1.FocusedRow = oNextRow<BR></P>]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 15:33:37 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10786&amp;title=programmatically-selecting-a-row#10786</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : I think I figured a faster way...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10785&amp;title=programmatically-selecting-a-row#10785</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1670">John31</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 3:20pm<br /><br /><P>I think I figured a faster way to do it but I need to know if I can LOCK the report control so they cannot click anything else until the process is complete?&nbsp; Is there a way to do this?</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 15:20:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10785&amp;title=programmatically-selecting-a-row#10785</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : Maybe you should use ReportRows.FindRow...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10784&amp;title=programmatically-selecting-a-row#10784</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 3:01pm<br /><br />Maybe you should use ReportRows.FindRow method to find the Row, then get its index.&nbsp; You should get the Row index and not the Record index ans the Record index will remain the same.]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 15:01:53 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10784&amp;title=programmatically-selecting-a-row#10784</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : I got this to work some of the...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10783&amp;title=programmatically-selecting-a-row#10783</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1670">John31</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 2:57pm<br /><br /><P>I got this to work some of the time.&nbsp; Here is my dilemma, I think.</P><P>The records in the ReportControl are pulled from a DB and then sorted various ways depending on user input.&nbsp; I then send a command to my server using the record id for each selected column to delete.&nbsp; When I get the server response it sends me back list of records that it has deleted which is the sRecID string in the code above.&nbsp; </P><P>I have no problem finding the records to delete using the code above. Finding the relative row to set focus back to is what the problem is.&nbsp; I can store the last index of the last removed record and then find this row.&nbsp; However, given that the ReportRows are sorted there is no guarantee that the row associated with the last index -1 is near the row that was just deleted.&nbsp; </P><P>Does this make sense or am I confusing everyone.</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 14:57:40 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10783&amp;title=programmatically-selecting-a-row#10783</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : I just tried this:Set wndReportControl.FocusedRow...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10782&amp;title=programmatically-selecting-a-row#10782</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 2:39pm<br /><br />I just tried this:<br><br>Set wndReportControl.FocusedRow = wndReportControl.Rows(8)<br><br>and it both focuses and selects the row.&nbsp; Is this not what you want?<br>]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 14:39:27 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10782&amp;title=programmatically-selecting-a-row#10782</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : Mario Did you mean FocusedRow?...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10780&amp;title=programmatically-selecting-a-row#10780</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1670">John31</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 2:30pm<br /><br /><P>Mario</P><P>Did you mean FocusedRow?&nbsp; This does not highlight the record either.&nbsp; Any other ideas?</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 14:30:17 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10780&amp;title=programmatically-selecting-a-row#10780</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row :  Try setting the ReportControl.FocusedRow ...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10779&amp;title=programmatically-selecting-a-row#10779</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 2:24pm<br /><br />Try setting the ReportControl.FocusedRow]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 14:24:17 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10779&amp;title=programmatically-selecting-a-row#10779</guid>
  </item> 
  <item>
   <title><![CDATA[Programmatically selecting a row : Is it possible to select a row...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10777&amp;title=programmatically-selecting-a-row#10777</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1670">John31</a><br /><strong>Subject:</strong> 3591<br /><strong>Posted:</strong> 02 February 2006 at 1:57pm<br /><br /><P>Is it possible to select a row programmatically?&nbsp; </P><P>For example:</P><P>The user is looking a record that is near the bottom of the list and has scrolled to get there.&nbsp; The user deletes this record.&nbsp; I can get the view to stay the same by restoring the TopRowIndex to the value it was before the Populate routine.&nbsp; However, if the user hits an arrow key the rc jumps to the top of the list.&nbsp; I have tried the following but it does not work as the row selected value goes back to false.</P><P>&nbsp;</P><P>Any Ideas?</P><P>lTopIndex = RC1.TopRowIndex</P><P>' loop through all report records<BR>For Each oRec In RC1.Records<BR>&nbsp;&nbsp;&nbsp; If InStr(1, sRecID, oRec.Item(COL_RECID).Value) Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set oRow = RC1.Rows.FindRow(oRec).NextSiblingRow<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RC1.Records. RemoveAt oRec.Index<BR>&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>Next<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<BR>RC1.Populate<BR>RC1.TopRowIndex = lTopIndex<BR>If Not oRow Is Nothing Then<BR>&nbsp;&nbsp;&nbsp; oRow.Selected = True<BR>End If</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 02 Feb 2006 13:57:36 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3591&amp;PID=10777&amp;title=programmatically-selecting-a-row#10777</guid>
  </item> 
 </channel>
</rss>