Results 1 to 3 of 3

Thread: ListView Problem

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    20

    ListView Problem

    I have a form with a ListView on it. I have created a column and added text to it...added some spaces and a time stamp so that the width is around 75
    characters long. When I open up the form in an emulator it looks as it
    should. However, when I deploy it to my device and open it up...the colum
    looks like the width is 0 and I have to stretch it to see the text.

    Any ideas on why this may be happening?

    Thanks

  2. #2
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: ListView Problem

    try this

    VB Code:
    1. 'inside the form_load
    2. lstview.Columns.Add("My Column Name", "210", _
    3.                              HorizontalAlignment.Left)
    4.  
    5. 'in a button click event
    6. Dim ls As New ListViewItem("Test1")
    7.  
    8.                 lstview.Items.Add(ls)
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    20

    Re: ListView Problem

    Thanks Strider,
    I ended up figuring this out after a few beer:

    lvwColumn = New ColumnHeader
    'lvwColumn.Width = -1
    'Set its text to the name of the field
    lvwColumn.Text = "Scan Data Start Time: " & Now & Space(95)
    'add Column to ListView
    ReaderDataListBox.Columns.Add(lvwColumn)


    All I did was comment out the lvwColumn.width = -1. I'm not sure why that didn't work on the device but did on the emulator. I guess it is redundant anyways.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width