Welcome Guest!
 VB Helper
 Previous Message All Messages Next Message 
VB Helper Newsletter  Rod Stephens
 Jun 05, 2009 12:02 PDT 

Reminder: If you promised to review my book "Beginning Database Design
Solutions," there's no time like the present!

Learn more about the book at:

    http://www.vb-helper.com/db_design.htm
    http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470385499.html
    http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/
----------
This week's examples show several different ways to display PDF files in
and out of a form in both VB 6 and VB .NET. Once you know how to do it,
it's actually pretty simple (assuming Adobe Reader is installed on your
computer).
----------
Have a great week and thanks for subscribing!

Rod
RodSte-@vb-helper.com

Books To Keep: http://www.BooksToKeep.com
----------
*** Now Available ***

Beginning Database Design Solutions
http://www.amazon.com/exec/obidos/ASIN/0470385499/vbhelper/

Visual Basic 2008 Programmer's Reference
http://www.amazon.com/exec/obidos/ASIN/0470182628/vbhelper/
==========

    VB6 Contents:
1. New HowTo: Open a PDF file in a WebBrowser control in Visual Basic 6
2. New HowTo: Open a PDF file in an external Adobe Reader process in
Visual Basic 6
3. New HowTo: Open a PDF file in an Adobe Reader control within an
application in Visual Basic 6

    VB.NET Contents:
4. New HowTo: List system process information similar to the information
provided by Task Manager in Visual Basic .NET
5. New HowTo: Open a PDF file in a WebBrowser control in Visual Basic
.NET
6. New HowTo: Open a PDF file in an external Adobe Reader process in
Visual Basic .NET
7. New HowTo: Open a PDF file in an Adobe Reader control within an
application in Visual Basic .NET

    Both Contents:
8. New Links
==========
++++++++++
   <VB6>
++++++++++
==========
1. New HowTo: Open a PDF file in a WebBrowser control in Visual Basic 6
http://www.vb-helper.com/howto_open_pdf_browser.html
http://www.vb-helper.com/HowTo/howto_open_pdf_browser.zip

Add a WebBrowser control to a form and use its Navigate method to open
the PDF file. It's that easy!

webPdf.Navigate txtFile.Text
==========
2. New HowTo: Open a PDF file in an external Adobe Reader process in
Visual Basic 6
http://www.vb-helper.com/howto_open_pdf_externally.html
http://www.vb-helper.com/HowTo/howto_open_pdf_externally.zip

Use the ShellExecute API function to "execute" the file. If Adobe Reader
is installed, it should open the file.

ShellExecute ByVal 0&, "open", txtFile.Text, _
    vbNullString, vbNullString, SW_SHOWMAXIMIZED
==========
3. New HowTo: Open a PDF file in an Adobe Reader control within an
application in Visual Basic 6
http://www.vb-helper.com/howto_open_pdf_reader.html
http://www.vb-helper.com/HowTo/howto_open_pdf_reader.zip

This only works if you have Adobe Reader installed. Then:

    1. On the Toolbox, right-click and select Components.
    2. Select the "Adobe Acrobat 7.0 Browser Control Type Library 1.0"
and click OK.
    3. Add a PDF reader to the form.

Now you can use the reader control's src property to open the PDF file.

pdfReader.src = txtFile.Text
==========
++++++++++
<VB.NET>
++++++++++
==========
4. New HowTo: List system process information similar to the information
provided by Task Manager in Visual Basic .NET
http://www.vb-helper.com/howto_net_enumerate_processes.html
http://www.vb-helper.com/HowTo/howto_net_enumerate_processes.zip

First, add a reference to System.Management.

When the program loads, it creates a ManagementSearcherObject to execute
the query "SELECT * FROM Win32_process." It loops through the results
saving the returned ManagementObjects and adding their captions to a
list box.

Private m_Results As List(Of ManagementObject)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
    m_Results = New List(Of ManagementObject)

    Dim searcher As New ManagementObjectSearcher("SELECT * FROM
Win32_process")
    For Each result As ManagementObject In searcher.Get()
        lstCaptions.Items.Add(result.Item("Caption"))

        m_Results.Add(result)
    Next result
End Sub

When you select an item from the list box, the program call subroutine
ShowDetail. This routine looks up the returned ManagementObject and
displays its textual value in an appropriate format. Use the program's
option buttons to pick the format.

' Show the detail for the selection.
Private Sub ShowDetail()
    If lstCaptions.SelectedIndex < 0 Then Exit Sub

    Dim result As ManagementObject =
m_Results.Item(lstCaptions.SelectedIndex)

    Dim txt As String
    If radMof.Checked Then
        txt = result.GetText(TextFormat.Mof).ToString()
    ElseIf radCimDtd20.Checked Then
        txt = result.GetText(TextFormat.CimDtd20).ToString()
    Else
        txt = result.GetText(TextFormat.WmiDtd20).ToString()
    End If

    txt = txt.Replace(vbLf, vbCrLf)
    txt = txt.Trim()
    txtDetails.Text = txt
End Sub
==========
5. New HowTo: Open a PDF file in a WebBrowser control in Visual Basic
.NET
http://www.vb-helper.com/howto_net_open_pdf_browser.html
http://www.vb-helper.com/HowTo/howto_net_open_pdf_browser.zip

Add a WebBrowser control to a form and use its Navigate method to open
the PDF file. It's that easy!

webPdf.Navigate(txtFile.Text)
==========
6. New HowTo: Open a PDF file in an external Adobe Reader process in
Visual Basic .NET
http://www.vb-helper.com/howto_net_open_pdf_externally.html
http://www.vb-helper.com/HowTo/howto_net_open_pdf_externally.zip

Simply call System.Diagnostics.Process.Start to "execute" the file. If
Adobe Reader is installed, it should open the file.

System.Diagnostics.Process.Start(txtFile.Text)
==========
7. New HowTo: Open a PDF file in an Adobe Reader control within an
application in Visual Basic .NET
http://www.vb-helper.com/howto_net_open_pdf_reader.html
http://www.vb-helper.com/HowTo/howto_net_open_pdf_reader.zip

This only works if you have Adobe Reader installed. Then:

    1. On the Toolbox, right-click and pick "Choose Items."
    2. Click the "COM Components" tab.
    3. Select "Adobe PDF Reader" and click OK.
    4. Add a PDF reader to the form.

Now you can use the reader control's src property to open the PDF file.

pdfReader.src = txtFile.Text
==========
++++++++++
<Both>
++++++++++
==========
8. New Links
http://www.vb-helper.com/links.html

AcademyX Computer Training
http://www.academyX.com
Hands-on classes in VB6, Excel VBA, Access VBA, Java, and more in San
Francisco, Los Angeles, Sacramento, and San Jose locations.
==========
Archives:
    http://www.topica.com/lists/VBHelper
    http://www.topica.com/lists/VB6Helper
    http://www.topica.com/lists/VBNetHelper

Post questions at:
    http://www.topica.com/lists/VBHelperQA
	
 Previous Message All Messages Next Message 
  Check It Out!

  Topica Channels
 Best of Topica
 Art & Design
 Books, Movies & TV
 Developers
 Food & Drink
 Health & Fitness
 Internet
 Music
 News & Information
 Personal Finance
 Personal Technology
 Small Business
 Software
 Sports
 Travel & Leisure
 Women & Family

  Start Your Own List!
Email lists are great for debating issues or publishing your views.
Start a List Today!

© 2001 Topica Inc. TFMB
Concerned about privacy? Topica is TrustE certified.
See our Privacy Policy.