Note that there are some explanatory texts on larger screens.

plurals
  1. POSelect row of unbound datagridview populated by query
    primarykey
    data
    text
    <p>I have a query that populates a DGV that looks like </p> <pre><code>private void textBox6_Leave(object sender, EventArgs e) { DataClasses3DataContext db = new DataClasses3DataContext(); int matchedAdd = (from c in db.GetTable&lt;prop&gt;() where c.HOUSE_NO.Contains(textBox1.Text) &amp;&amp; c.Direction.Contains(textBox2.Text) &amp;&amp; c.street.Contains(textBox3.Text) &amp;&amp; c.SUFF.Contains(textBox4.Text) select c.ID).SingleOrDefault(); var before = (from c in db.GetTable&lt;prop&gt;() where c.ID &lt; matchedAdd orderby c.PARCEL descending select c).Take(6); var after = (from c in db.GetTable&lt;prop&gt;() where c.ID &gt; matchedAdd orderby c.PARCEL select c).Take(6); var endResult = before.Concat(after); dgvBRT.DataSource = endResult; } </code></pre> <p>I need to be able to select a row and open BRTDetail from the DGV after its populated by that query. This is the first time I have had to use an unbound grid. The code I normally use is below. Obviously it doesn't work since BRTDataSet is irrelevant at that point. How do I select a row in this case?</p> <pre><code> private void dgvBRT_DoubleClick(object sender, EventArgs e) { System.Data.DataRowView SelectedRowView; BRTDataSet.propRow SelectedRow; SelectedRowView = (System.Data.DataRowView)propBindingSource.Current; SelectedRow = (BRTDataSet.propRow)SelectedRowView.Row; frmBRTDetail BRTDetail = new frmBRTDetail(this); BRTDetail.LoadBRTNumberKey(SelectedRow.PARCEL, null); BRTDetail.LoadBldgKey(SelectedRow.BLDG_CD, null); BRTDetail.Show(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload