CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Load .Pdf from harddisk via listboxes


    I'm New with VB 2010 express and I'm trying a project for getting information from my harddisk (Pdf and Word documents).
    I have a database with different machine(Forklifts) information and I have made a Form with 3 Listboxes and a Button.When I select a Brand in Listbox1, I get a selection of Types of that Brand in Listbox2 when I select a Item (drawings,Faultcodes etc.) in Listbox3 and I doubleclick on that item or click the button I get a messagebox with the selected items.This part of the program works but now i want it to open the pdf-file belonging to that selection.

    For example: I want it to open the "onderhoudsschema's" (service-sceme)(Listbox3) of the "Cesab" (Machine)(Listbox1) of the type "M300" (Listbox 2).These are at a fixed location F:\B300-400 RP.pdf.
    All the information is at fixed locations on my harddrive.
    I don't know how to integrate it at my excisting program,this is what I have sofar:

        Public Class FormMachines  
            Private ReadOnly machineCollection As New List(Of Machine)(  
                    {New Machine("Atlet", {"LEH 16c", "PLL", "PLP", "TLP"}),  
                     New Machine("BT", {"LPE 180"}),  
                     New Machine("Caterpillar", {"DP15", "DP40", "EP10", "GP15", "GP40"}),  
                     New Machine("Cesab", {"Blitz", "B200", "B300", "B400", "B600", "B800", "Centauro"}),  
                     New Machine("Hyster", {"A1.3", "E1.6", "J1.5", "J2.2"}),  
                     New Machine("Toyota", {"7FBMF", "7FBEF"})})  
            Private Sub FormMachines_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load  
                ListBoxMachines.DataSource = machineCollection  
                ListBoxMachines.DisplayMember = "Merk"  
                ListBoxMachineInfo.DataSource = {"Elektrische schema's", "Hydraulische schema's",  
                                               "Foutcodes", "Onderhoudsschema's", "Specifieke Storingen"}  
            End Sub  
            Private Sub ListBoxMachines_SelectedIndexChanged(sender As Object, e As EventArgs) _  
            Handles ListBoxMachines.SelectedIndexChanged  
                Dim machine = TryCast(ListBoxMachines.SelectedValue, Machine)  
                If machine Is Nothing Then  
                    ListBoxType.DataSource = Nothing  
                    ListBoxType.DataSource = machine.Type  
                End If  
            End Sub  
            Private Sub ListBoxMachineInfo_DoubleClick(sender As Object, e As EventArgs) Handles ListBoxMachineInfo.DoubleClick  
            End Sub  
            Private Sub ButtonToonInfo_Click(sender As System.Object, e As EventArgs) Handles ButtonToonInfo.Click  
            End Sub  
            Private Sub ToonInfo()  
                Dim boodschap = String.Format("Toon {0} van {1} ({2})",  
                                              ListBoxMachineInfo.Text, ListBoxMachines.Text, ListBoxType.Text)  
                MessageBox.Show(boodschap, "Info tonen", MessageBoxButtons.OK, MessageBoxIcon.Information)  
            End Sub  
        End Class  
        Public Class Machine  
            Public Property Merk As String  
            Public Property Type As List(Of String)  
            Sub New(merk As String, type As IEnumerable(Of String))  
                Me.Merk = merk  
                Me.Type = New List(Of String)(type)  
            End Sub  
        End Class
    I Hope someone can help me any further....Thanks !

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    Re: Load .Pdf from harddisk via listboxes

    Well you are going to have to associate a file with it somehow but I don't see anything there that would enable you to know which file should be opened.
    Always use [code][/code] tags when posting code.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.