General discussion

Locked

Need Help With The List View Control

By shaknbak ·
I am having a problem adding a list item to the list view control from another
form. I have a tree view control that when clicked populates to text boxs
on a seperate form. There are another 2 text boxs on that form that need
to be completedbefore the list item can be added to the list box. I can
bet the information I want in a string on the main form, but when I try
to add the list item, nothing happens. My list item count increases as well
as the indexs, but no text shows up. Some of the code I have tried using
is below.

Public Function holdInfo(infoFromOtherForm)

Dim listItemAdd As ListItem
Set listItemAdd = lvListView.ListItem.Add()
'Here I get the information back from the seperate form
listItemAdd.Text = infoFromOtherForm
End Function

Any ideas would be great.

Gregg

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Need Help With The List View Control

by Ruler In reply to Need Help With The List V ...

I'm assuming from the code snippet that you're using Visual Basic. I'm by no means an expert at VB (I prefer Delphi), but there are a couple of things you might want to check.

First, check for a Refresh or UpdateControl method to force the control to repaint itself. If the count property increases, the item should have been added to the list, but for some reason it's not being displayed. Also on this line, try shifting the focus to that form and/or repainting the entire form on the screen.

Second, I don't know how VB handles the scope of variables and memory allocation/deallocation when you use local variables to add to visual controls, but it looks like you're declaring listitem as a local variable; wouldn't this variable be un-available outside of this procedure? (One of the VB junkies could easily answer this; it's just something I noticed that might be causing a problem. Delphi has an AddItem method that you pass a string and it adds it to the control without the use ofintermediate variables.)

Hope this helps.

Collapse -

Need Help With The List View Control

by shaknbak In reply to Need Help With The List V ...

Poster rated this answer

Collapse -

Need Help With The List View Control

by shaknbak In reply to Need Help With The List V ...

This question was closed by the author

Back to Web Development Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums