hi every body , i have recently developed a system using vb6 forms but i need a help o f how to save and view a file with the pdf and .dwg and view it in a form , any help plz ??

Since this has been here for 8 hours, here are some suggestions:
Must ask how necessary it is to open the PDF "in" vb6.
If you can use vb6 to open a PDF in Adobe the Shell Execute API offers some possibilities to open and print PDF. A bit of searching might get you on the right track.
Also I see an Adobe Acrobat 8.0 library and Adobe Reader File Preview Type Library in my (very old) references, but know nothing about them. Again perhaps a search for these specific references might turn up some code for you.
It appears some of these issues are addressed on the Adobe discussion boards.
I don't know what your search criteria is but you might try doing it backward like: AutoCad in VB6 etc.

i don't have any idea really of how to open the pdf file in vb6 , but if there is no method to save the AutoCad can I make an hyperlink of the file I mean can I save the file path the open the file ??

After much searching (only because it is an interesting topic) I have found that there is such a thing as an Adobe.OCX that can be downloaded, regestered, selected in components and placed on your form from the tool box. However it would be for private use (can't distribute with your application) and I can't find a download site that I trust.

Second best (works for me and does not require any special Declaration, Reference or Component) is to use Shell:

Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe" & " " & "C:\PathToYourPDF.pdf", vbNormalFocus

Notes:
Program Files: you will have to look for the version of the reader on your machine (10.0 in my case).

Also I would guess that if you have AutoCad installed you should be able to open task manager then start AutoCad and find the Process that runs AutoCad. This process will replace the "AcroRd32.exe" and of course you will need to set path to the folder where that process (exe) resides
I hope that helps

thx Klahr R i will try it and tell you what will happen with me , but i have a question can i read the path from textbox or file name ?

Sure. Just substitute the Text.Text for the path or file name. Another possibility that reads a little easier is to declare a String variable and build the path from the different sources, then use the variable in the Shell call

Dim MyString as String
    MyString = MyApplication.Text & " " & MyPDFFile.Text & "," & "VBNormalFocus"
    Path MyString

By the way, I get a fault code when opening the PDF. It may just be my Vista that doesn't like me using a computer at all. You might be able to head it off with an error handler.

Well this code working with my form Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe" & " " & "C:\PathToYourPDF.pdf", vbNormalFocus
but when i added the following code

Dim MyString as StringMyString = textfield.text`
Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe" & " " & "C:\textfield.text.pdf", vbNormalFocus
its open a reader with error cant open the file ,, any help plz??

Very close
Take the quotes off the Textfield.Text
And put the C: and the .pdf in the text box with the rest of the path.
That works for me.
Inline Code Example Here
Should be one of the following
Prefered

Textfield.Text = "C:\MyPath\MyPDF.pdf"
Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe" & " " & "C:\textfield.text.pdf", vbNormalFocus

Or if you can't include the C: and .pdf in the textfield textbox

Textfield.Text = "MyPath\MyPDF"
Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe" & " " & "C:\" & Textfield.Text & ".pdf", vbNormalFocus

Regards

yes , Klahr_R posted correct
you need to use "C:\" & Textfield.Text & ".pdf" instead of "C:\textfield.text.pdf"

if you're using textfield.text.pdf , then will check for the file named textfield.txt and having extention .pdf

so use this "C:\" & Textfield.Text & ".pdf" for desired output.

atlast also make sure that when you input the filename into textbox then don't add pdf extention

rishif:
Thanks for catching that. I picked up the wrong line of code from my test project
The prefered method would be to put the complete path, including drive and extension, in the text box.

Text2.Text = "C:\MyPath\MyDocument.pdf"
Shell "C:\Program Files\Adobe\Reader 10.0\Reader\AcroRd32.exe" & " " & Text2.Text, vbNormalFocus

It works either but is probably easier to read this way.

Thx all this code 100% Slove my Question

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.