Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Listview Control Problem


Message #1 by "Terry Holland" <londontel@h...> on Thu, 15 Mar 2001 15:42:36
here's a fix:

set your listview to reportmode - when populating it, then when you're done set it
back to list:

Private Sub Form_Activate()
ListView1.View = lvwList
End Sub

Private Sub Form_Load()

Dim itm As ListItem
Dim i As Integer
ListView1.View = lvwReport

ListView1.ColumnHeaders.Add , , " "

For i = 1 To 15
    Set itm = ListView1.ListItems.Add(, , "This the " & i & Replace(Space(i), " ",
".") & " item.")
Next i

ListView1.ColumnHeaders(1).Width = ListView1.Width - 100

End Sub


you can't change the style in the same routine where you've built it and have it
work, for some reason, so i used the form_activate event instead.  but this seems to
be working.  if you take out the code in the form_activate event, the text is
truncated, but if you put in, you can see it all.

hope this helps,

john

ps, is there a reason why you can't use report mode with one column and hide the
column headers?  it's much easier and probably a lot more stable than this.


--- "Polsky, Eva" <EPolsky@s...> wrote:
> Move "lvwListView.View = lvwList" to the end of your code - after you added
> items. And I'm not sure if you need to use Autosize.
> 
> -----Original Message-----
> From: Terry Holland [mailto:londontel@h...]
> Sent: Friday, March 16, 2001 9:12 AM
> To: professional vb
> Subject: [pro_vb] RE: Listview Control Problem
> 
> 
> I dont want my listview in Report or Icon mode.  I want to keep it in List 
> mode but I want to see all of the text.  It must be possible because in 
> Windows Explorer, if I set my folder view to List,  I get columns of 
> filenames going down and then across, with no truncating of filenames ie 
> the column widths are automalically set to the widest filename.  I dont 
> want Icon view because I dont want the user to move the items.
> 
> Thanks
> 
> -Tel
> 
> 
> > Change:
> > 	lvwListView.View = lvwList
> > to:
> > 	lvwListView.View = lvwReport
> > 
> > 
> > 
> > -----Original Message-----
> > From: Terry Holland [mailto:londontel@h...]
> > Sent: Thursday, March 15, 2001 9:43 AM
> > To: professional vb
> > Subject: [pro_vb] Listview Control Problem
> > 
> > 
> > My Listview control is truncating my text when in List view.  Adjusting 
> > column widths has no effect.
> > 
> > Here is my code and an expanation of what I want.
> > 
> > 
> > Thanks in advance
> > 
> > 
> >   Set lvwListView = lvwTest
> >   lvwListView.View = lvwList
> >   
> >   ListView_AutoSize lvwListView
> >   
> >   With lvwListView
> >     
> >    .ListItems.Add , , "abcdefghijklmnopqrstuvwxyz"
> >    .ListItems.Add , , "abcdefghijklmnopqrstuvwxyz"
> >    .ListItems.Add , , "abcdefghijklmnopqrstuvwxyz"
> >    .ListItems.Add , , "abcdefghijklmnopqrstuvwxyz"
> >    .ListItems.Add , , "abcdefghijklmnopqrstuvwxyz"
> >    .ListItems.Add , , "abcdefghijklmnopqrstuvwxyz"
> >   End With
> > 
> > 
> > I get a listview showing
> > 
> > abcdefghijklmnop...    abcdefghijklmnop...
> > abcdefghijklmnop...    abcdefghijklmnop...
> > abcdefghijklmnop...    abcdefghijklmnop...
> > 
> > 
> > How do I get 
> > 
> > abcdefghijklmnopqrstuvwxyz    abcdefghijklmnopqrstuvwxyz
> > abcdefghijklmnopqrstuvwxyz    abcdefghijklmnopqrstuvwxyz
> > abcdefghijklmnopqrstuvwxyz    abcdefghijklmnopqrstuvwxyz
> 
> 

John Pirkey 
MCSD 
John@S... 
http://www.stlvbug.org

  Return to Index