Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is ListView not refreshing?
    primarykey
    data
    text
    <p>Hi I am inserting into a table then reading everything back into a <code>ListView</code> When I re-open the program I see the data I just saved in my <code>ListView</code>, but this record is not showing in my <code>ListView</code> at the time of saving (although it is saved in the table). </p> <p>I am using </p> <pre><code> listView.Update() </code></pre> <p>as well as</p> <pre><code> listView.Refresh() </code></pre> <p>but it does not seem to work. I am just using a <code>SELECT</code> query to read data off the <code>datareader</code> and store it in my <code>listView</code> as follows (which is working properly)</p> <p>The only problem is that the listView is not refreshing immediately, but it works when I close/open the program</p> <p>here's the code I am using at the end of my Save method. basically these two methods get called </p> <pre><code> Private Sub SetColumns() Dim lstpenalty As New ListView() lstpenalty.Items.Clear() lstpenalty.Visible = True lstpenalty.Bounds = New Rectangle(New Point(390, 55), New Size(560, 379)) lstpenalty.Name = "lstpenalty" lstpenalty.FullRowSelect = True lstpenalty.View = View.Details lstpenalty.GridLines = True lstpenalty.Items.Clear() lstpenalty.Columns.Add("a", 75) lstpenalty.Columns.Add("b", 70) lstpenalty.Columns.Add("c", 105) lstpenalty.Columns.Add("d", 98) lstpenalty.Columns.Add("e", 90) lstpenalty.Columns.Add("f", 105) Me.Controls.Add(lstpenalty) LoadPenaltyList(lstpenalty) End Sub Private Sub LoadPenaltyList(ByRef listView As ListView) Dim gDR As OracleDataReader Dim cmd As New OracleCommand Dim lstpenaltyview As New ListViewItem Try cnn.Connect_to_Oper_Agent() cmd.Connection = cnn.cnn listView.Items.Clear() cmd.CommandText = " select a," &amp; _ "b, " &amp; _ "c, " &amp; _ "d," &amp; _ "e," &amp; _ "f" &amp; _ " FROM myTable" &amp; _ " commit" gDR = cmd.ExecuteReader() While gDR.Read lstpenaltyview = listView.Items.Add(Null_To_String(gDR("a"))) lstpenaltyview.SubItems.Add(gDR("b")) lstpenaltyview.SubItems.Add(gDR("c")) lstpenaltyview.SubItems.Add(gDR("d")) lstpenaltyview.SubItems.Add(gDR("e")) lstpenaltyview.SubItems.Add(gDR("f")) End While listView.Update() Catch ex As Exception MsgBox("There was an error... -&gt; " &amp; ex.ToString) Finally cmd.Dispose() cnn.Close_Conn() End Try End Sub </code></pre> <p>Thanks for your help </p>
    singulars
    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