473,386 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Setting ListView.SubItem(x).Text

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
Jul 21 '05 #1
1 4384
Thanks for replying.
Unfortunately refreshing the listview does not work.

Stefan.
"purushotham bc" <bc******@rediffmail.com> wrote in message
news:03****************************@phx.gbl...
Hi,
Use the public method Refresh of Listview to see the
changes...

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: andrewcw | last post by:
The clcik event on the ListView control seems to trigger off the item level ( the first column ). I would like to be able to trap the click event on a particular subitem ( a specific column's row...
0
by: Andrew | last post by:
If item is a ListViewItem and str is a string, why do the following two lines not have the same effect ? item.SubItems.Add(new ListViewItem.ListViewSubItem()).Text = str;...
2
by: David | last post by:
Hello. In listview I have 3 collumns. How can I read text from 2rd ITEM - 2nd Subitem Example: Mark PEter June HEllo By All Sony Philips Panasonic This is listview:
3
by: Rob Richardson | last post by:
Greetings! I am attempting to display data in tabular form using a ListView control in detail mode. This is for a program I originally wrote in VB6. In VB6, I would add an item to the...
6
by: Jack | last post by:
Hello, I've noticed through searching this group's previous posts that one can get the item the mouse is over in a listview control but I did not see how to get the subitem the mouse is over. Is...
5
by: Martin Horn | last post by:
Hi all, I want to implement a listview with editable subitems and I assume the easiest way is to overlay a textbox over the item to be edited. With this in mind I have come up with: Using...
10
by: Adam Honek | last post by:
This is probably a silly question but oh well, I can't find the answer looking via code. Having an imagelist already, how does one set an icon for a list view's sub items? I'm using the code...
7
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR ...
1
by: James | last post by:
Hi All, I have an ownerdraw ListView control. I'm trying to use an ownerdrawn ListView control to draw and display images in the second column of a listview which is set to detail view. I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.