S
Stefan De Schepper
Hi all,
I made an overview of all my contacts. This overview is shown in a ListView.
I programmatically add as many columns as there are in my contacts database
table. All the contacts and their information are shown nicely.
When I doubleclick an item I show a window in which the user can alter any
of the data for teh selected contact. After clicking the OK-button I change
the database and then try to set the text property of all the subitems of
the selected contact. None of the alterations are displayed. When displaying
the subitem in the QuickWatch window, the Text property is correctly set to
the new value. Any idea what I'm doing wrong here?
Here's my code:
Private Sub LV_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LV.DoubleClick
If LV.SelectedItems.Count = 0 Then
Exit Sub
End If
Dim f2 As New Form2()
Dim Rst As New ADODB.Recordset()
Dim SelLVI As ListViewItem = LV.SelectedItems(0)
With f2
Rst.Open("SELECT * FROM Adressen WHERE pk = " & CType(SelLVI.Tag,
String), Con, ADODB.CursorTypeEnum.adOpenKeyset,
ADODB.LockTypeEnum.adLockOptimistic)
If Not IsDBNull(Rst.Fields("Naam").Value) Then
.txtNaam.Text = CType(Rst.Fields("Naam").Value, String)
End If
If Not IsDBNull(Rst.Fields("Adres").Value) Then
.txtAdres.Text = CType(Rst.Fields("Adres").Value, String)
End If
.bChanged = False
.ShowDialog(Me)
If .bOK Then
If .bChanged Then
Rst.Fields("Naam").Value = .txtNaam.Text
Rst.Fields("Adres").Value = .txtAdres.Text
Rst.Update()
SelLVI.Text = .txtNaam.Text 'This is displayed correctly
SelLVI.SubItems(1).Text = .txtAdres.Text 'This is NOT displayed
correctly
End If
End If
.Close()
Rst.Close()
End With
End Sub
Thanks in advance,
Stefan
I made an overview of all my contacts. This overview is shown in a ListView.
I programmatically add as many columns as there are in my contacts database
table. All the contacts and their information are shown nicely.
When I doubleclick an item I show a window in which the user can alter any
of the data for teh selected contact. After clicking the OK-button I change
the database and then try to set the text property of all the subitems of
the selected contact. None of the alterations are displayed. When displaying
the subitem in the QuickWatch window, the Text property is correctly set to
the new value. Any idea what I'm doing wrong here?
Here's my code:
Private Sub LV_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles LV.DoubleClick
If LV.SelectedItems.Count = 0 Then
Exit Sub
End If
Dim f2 As New Form2()
Dim Rst As New ADODB.Recordset()
Dim SelLVI As ListViewItem = LV.SelectedItems(0)
With f2
Rst.Open("SELECT * FROM Adressen WHERE pk = " & CType(SelLVI.Tag,
String), Con, ADODB.CursorTypeEnum.adOpenKeyset,
ADODB.LockTypeEnum.adLockOptimistic)
If Not IsDBNull(Rst.Fields("Naam").Value) Then
.txtNaam.Text = CType(Rst.Fields("Naam").Value, String)
End If
If Not IsDBNull(Rst.Fields("Adres").Value) Then
.txtAdres.Text = CType(Rst.Fields("Adres").Value, String)
End If
.bChanged = False
.ShowDialog(Me)
If .bOK Then
If .bChanged Then
Rst.Fields("Naam").Value = .txtNaam.Text
Rst.Fields("Adres").Value = .txtAdres.Text
Rst.Update()
SelLVI.Text = .txtNaam.Text 'This is displayed correctly
SelLVI.SubItems(1).Text = .txtAdres.Text 'This is NOT displayed
correctly
End If
End If
.Close()
Rst.Close()
End With
End Sub
Thanks in advance,
Stefan