Quantcast
Channel: Visual Studio Tools for Office (VSTO) forum
Viewing all articles
Browse latest Browse all 5157

Populate mulit-column listbox (windows form) or can I use a VBA userform listbox with managed code addin?

$
0
0

I am trying to create a Word COM Addin that displays a windows form and multi-column listbox.  At the basic level, I want to populate the list box using a two dimensional array as I've tried below. In actual practice I would like to populate an unbound listbox using the data from an Excel worksheet or Access database. Can that be done?  I'm familiar with VBA and realize that VB and VBA are different, so I am wondering if there is a VB equivalent to VBA ListBox1.List?

I'm very new to VB so perhaps I am all wrong in trying to use windows form or a windows form listbox.  Is there something else I should use?  It would certainly flatten the learning curve if it were possible to use a VBA userform in my project.  Is that possible?

Thanks

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
        Dim myList(2, 1) As String
        myList(0, 0) = "One"
        myList(0, 1) = "1"
        myList(1, 0) = "Two"
        myList(1, 1) = "2"
        myList(2, 0) = "Three"
        myList(2, 1) = "1"
        'Error here.
        ListBox1.List myList
    End Sub


Greg Maxey Please visit my website at: http://gregmaxey.mvps.org/word_tips.htm


Viewing all articles
Browse latest Browse all 5157

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>