Question Load pdf file from harddisk via listboxes

Olliezz

New member
Joined
May 17, 2014
Messages
1
Programming Experience
Beginner
Hello,

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  
            Else  
                ListBoxType.DataSource = machine.Type  
            End If  
        End Sub  
         
        Private Sub ListBoxMachineInfo_DoubleClick(sender As Object, e As EventArgs) Handles ListBoxMachineInfo.DoubleClick  
            ToonInfo()  
        End Sub  
      
        Private Sub ButtonToonInfo_Click(sender As System.Object, e As EventArgs) Handles ButtonToonInfo.Click  
            ToonInfo()  
        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 give me a set-up & help me any further....Thanks !
 
Last edited by a moderator:
Firstly, I've fixed your code formatting. You need to specify a "vb" option to get VB syntax highlighting.

So basically you're saying that you want to combine the selected items from three ListBoxes to specify the path of a file to open, correct? Well, how exactly does the data in the ListBoxes relate to the file path? Your example and your code doesn't really explain that. It sounds like a simple case of combining a few Strings together but the question is where those Strings come from.
 
Back
Top