Help - Search - Members - Calendar
Full Version: VB.NET ListView Tiles...
ieXbeta Board > Tech > Developer Center
DangerousDave86
Can anyone get this example to work? I can't and its really bugging me. I get the build error that "'Tile' is not a member of 'System.Windows.Forms.View'." and "'TileSize' is not a member of 'System.Windows.Forms.ListView'"
I'm on .net 1.1 I believe. this is VS2003.
Thanks in advance.
liquidplasmaflow
Try
CODE
ListView1.View = System.Windows.Forms.ListView.View.Tile

and make sure that you're referencing your instance of ListView for the second problem (i.e. ListView1 or whatever you named it) instead of the static class System.Windows.Forms.ListView.
DangerousDave86
Thanks for the suggestions liquidplasmaflow. I am referencing my instance of listview in the second case, however you example code comes up as invalid. It could just be my windows. However, with invalid code, I cannot compile to test on another machine without installing VS2003 first. I may have to give up on this, google and msdn arent being much help.
liquidplasmaflow
Throw the whole thing in a ZIP and upload it, I'll take a look at it tomorrow.
DangerousDave86
The app is just a test app, just one form with the following code after the default stuff VS puts in.
CODE
    Public Shared Sub main()
        Application.EnableVisualStyles()
        System.Windows.Forms.Application.Run(New Form1)
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Application.EnableVisualStyles()
        ' Initialize myListView.
        Dim myListView As New ListView
        myListView.Dock = DockStyle.Fill
        myListView.View = System.Windows.Forms.ListView.View.Tile

        ' Initialize the tile size.
        myListView.TileSize = New Size(400, 45)

        ' Initialize the item icons.
        Dim myImageList
        myImageList = New ImageList
        Dim myIcon As Icon = New Icon("book.ico")
        Try
            myImageList.Images.Add(myIcon)
        Finally
            myIcon.Dispose()
        End Try
        myIcon.Dispose()
        myImageList.ImageSize = New Size(32, 32)
        myListView.LargeImageList = myImageList

        ' Add column headers so the subitems will appear.
        myListView.Columns.AddRange(New ColumnHeader() _
            {New ColumnHeader, New ColumnHeader, New ColumnHeader})

        ' Create items and add them to myListView.
        Dim item0 As New ListViewItem(New String() _
            {"Programming Windows", _
            "Petzold, Charles", _
            "1998"}, 0)
        Dim item1 As New ListViewItem(New String() _
            {"Code: The Hidden Language of Computer Hardware and Software", _
            "Petzold, Charles", _
            "2000"}, 0)
        Dim item2 As New ListViewItem(New String() _
            {"Programming Windows with C#", _
            "Petzold, Charles", _
            "2001"}, 0)
        Dim item3 As New ListViewItem(New String() _
            {"Coding Techniques for Microsoft Visual Basic .NET", _
            "Connell, John", _
            "2001"}, 0)
        Dim item4 As New ListViewItem(New String() _
            {"C# for Java Developers", _
            "Jones, Allen / Freeman, Adam", _
            "2002"}, 0)
        Dim item5 As New ListViewItem(New String() _
            {"Microsoft .NET XML Web Services Step by Step", _
            "Jones, Allen / Freeman, Adam", _
            "2002"}, 0)
        myListView.Items.AddRange( _
            New ListViewItem() {item0, item1, item2, item3, item4, item5})

        ' Initialize the form.
        Me.Controls.Add(myListView)
        Me.Size = New System.Drawing.Size(430, 500)
        Me.Text = "ListView Tiling Example"
    End Sub

Cheers
vbjay
You have to use VS 2005 and framework v2.0 to get those options.
DangerousDave86
Thanks vbjay. Any idea why? Seeing as XP uses the Tile view and was around before 2k5? Just curious is all.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.