G
Guest
listbox doesn't refresh after adding an item.
On a page I have 4 listboxes, the last three of which are child entries of
the previous. Works fine.
Above each listbox I have a New button. New opens up a NewConcepts form in
an AddNew state. I fill in the new concept, update the database and the form
closes.
NewConcepts was opened showdialog so focus returns to the listboxes. I
would have expected the listbox to show the new concept, but it doesn't.
Here is the code for the relevant New button:
Private Sub btnNewC0_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNewC0.Click
Dim frm As New frmNewConcept
With frm
'.iNew = Me.lstConcepts0.SelectedValue this is true for all the
others
.iNew = 0
.iNewAddMode = True
.ShowDialog()
End With
'Dim int As Integer = frm.iAddNumber
'MsgBox(int.ToString)
If frm.iAddNumber > 0 Then
Me.dsC.Clear()
Me.daC.Fill(dsC, "Concepts")
Me.lstConcepts0.Refresh()
End If
frm.Dispose()
End Sub
If I check the database, the new concept is there. If I close the form and
reopen it, the new concept is there.
Can somebody please be so kind as to show me how to persuade the listbox to
show the new item?
Thank you.
Dennis
On a page I have 4 listboxes, the last three of which are child entries of
the previous. Works fine.
Above each listbox I have a New button. New opens up a NewConcepts form in
an AddNew state. I fill in the new concept, update the database and the form
closes.
NewConcepts was opened showdialog so focus returns to the listboxes. I
would have expected the listbox to show the new concept, but it doesn't.
Here is the code for the relevant New button:
Private Sub btnNewC0_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNewC0.Click
Dim frm As New frmNewConcept
With frm
'.iNew = Me.lstConcepts0.SelectedValue this is true for all the
others
.iNew = 0
.iNewAddMode = True
.ShowDialog()
End With
'Dim int As Integer = frm.iAddNumber
'MsgBox(int.ToString)
If frm.iAddNumber > 0 Then
Me.dsC.Clear()
Me.daC.Fill(dsC, "Concepts")
Me.lstConcepts0.Refresh()
End If
frm.Dispose()
End Sub
If I check the database, the new concept is there. If I close the form and
reopen it, the new concept is there.
Can somebody please be so kind as to show me how to persuade the listbox to
show the new item?
Thank you.
Dennis