none
MSWord Form - ListBox Selected Items - VB.net RRS feed

  • Question

  • I'm trying to get my form to display all selected items from listboxes in a txt box.  I'm using Open XML Word. 
    Here's what I've worked on so far:

    How can I add a button or call a function properly?  I have multiple listboxes on this form.

    Protected Function RetrieveSelectedList( _
      ByVal lc As ListControl) As String
        Dim li As ListItem
        Dim strOut As String = String.Empty
        'This method retrieves selected items from the list boxes
        'and displays the list in a textbox
        For Each li In lc.SelectedValue
    
          strOut = strOut + ";" + li.InnerText
    
        Next
        If strOut.StartsWith(";") Then
          strOut = strOut.Substring(1)
    
        End If
    
        Return strOut
        strOut = txtBxProdFac.Text
    
      End Function
    Thursday, May 20, 2010 1:36 AM

Answers

  • Thank you Ji,

    I found my answer.  I worked though many scenarios for this requirement.  From creating an xml document and trying to connect the data to the Word document, trying Linq to XML...etc.

    I re-worked the Word document using Word and Visual Studio and the enduser is pleased.

    Thursday, May 20, 2010 8:35 PM

All replies

  • Hello,

    This forum is for OpenXML SDK which is Microsoft provided APIs for office openxml file reading, writing, and manipulating.

    From your question, I cannot see any part related to the OpenXML SDK. The codes look totally in a Windows Form application context. So, if you want to get more help on the question, could you please elaborate more,

    1. What is the ListControl?

    2. What do you mean about using Open XML Word.

    If you can provide more information, I will be happy to see if I can directly give any help on this. Even not, I think we can redirect you to a more appropriate place for the question.

     

    Best regards,

    Ji Zhou


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, May 20, 2010 3:47 PM
    Moderator
  • Thank you Ji,

    I found my answer.  I worked though many scenarios for this requirement.  From creating an xml document and trying to connect the data to the Word document, trying Linq to XML...etc.

    I re-worked the Word document using Word and Visual Studio and the enduser is pleased.

    Thursday, May 20, 2010 8:35 PM