[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

LsitView Runtime Population

Posted on 2011-03-22
1
Medium Priority
?
226 Views
Last Modified: 2012-05-11
I want to try and populate a list view of 5 columns and 15 rows. When I try and add values to my channelValue string. When I add a value   ChannelValue(0) = "11" how can I move to the next row?
Private Sub frmChannelUpdate_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       

        LV_Channels.View = System.Windows.Forms.View.Details

        ' Adding ListView Columns
        LV_Channels.Columns.Add("RF Channel", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Min Frequency", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Middle Frequency", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Max Frequency", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Description", 170, HorizontalAlignment.Left)

        Dim ChannelValue(15) As String
        Dim itm As ListViewItem
        ChannelValue(0) = "11"

        itm = New ListViewItem(ChannelValue)
        LV_Channels.Items.Add(itm)


    End Sub

Open in new window

0
Comment
Question by:cmdolcet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
ID: 35189604
I would use a sub-method which will add the items to your grid (to maintain the code easier).
Example below ....
Private Sub frmChannelUpdate_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       

        LV_Channels.View = System.Windows.Forms.View.Details

        ' Adding ListView Columns
        LV_Channels.Columns.Add("RF Channel", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Min Frequency", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Middle Frequency", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Max Frequency", 100, HorizontalAlignment.Left)
        LV_Channels.Columns.Add("Description", 170, HorizontalAlignment.Left)

' Add the first row
        AddItem "11","12","13","14","15"
' Add the second row
        AddItem "21","22","23","24","25"
...



    End Sub

private sub AddItem (byval RFChannel as string, byval MinFrequency as string, byval MiddleFrequency
 as string, byval MaxFrequency, byval Description as string)
        Dim ChannelValue(5) As String
        Dim itm As ListViewItem
        ChannelValue(0) = RFChannel 
        ChannelValue(1) = MinFrequency 
        ChannelValue(2) = MiddleFrequency
        ChannelValue(3) = MaxFrequency
        ChannelValue(4) = Description 

        itm = New ListViewItem(ChannelValue)
        LV_Channels.Items.Add(itm)
end sub

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question