|
Thanks for the reply, I will take a look at the link.
Are you aware of any examples that show this being done?
|
|
|
|
|
There are examples, but you really have to search for them. Read up on COM Interoperability.
You can check out this[^] example here on CP. It's written in C#, but should translate to VB without too much trouble. Make sure you read the comments at the bottom of the article too! There are some pitfalls getting this to work! You've got a bunch of research to do!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I know I'll get hell for this one....How do I print a PDF file from vbnet?
My code is below which populates a crystal reports document and saves it as a pdf, how can I print it now?
Dim sc As New PP.BusinessLogicLayer.Schedule()
sc.ScheduleStamp = Session("Sch")
sc.StudyNo = txtStudyNumber.Text.Trim
sc.AQ = Session("AQ")
sc.PrintTopSheet()
Dim CRDoc As New ReportDocument()
CRDoc.Load("C:\w\x\y\z.rpt")
Dim logonInfo As New TableLogOnInfo()
Dim i As Integer
For i = 0 To CRDoc.Database.Tables.Count - 1
logonInfo.ConnectionInfo.ServerName = serverName
logonInfo.ConnectionInfo.DatabaseName = databaseName
logonInfo.ConnectionInfo.UserID = uid
logonInfo.ConnectionInfo.Password = pwd
CRDoc.Database.Tables.Item(i).ApplyLogOnInfo(logonInfo)
Next
Dim crExportOptions As ExportOptions
Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim Fname As String
Fname = "\\a\b\c.pdf"
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = CRDoc.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
CRDoc.Export()
|
|
|
|
|
You have to shell out to Acrobat Reader to print it. The command line is:
"C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe" /p /h "<fullPathToFileHere>"
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Dave, I have a 2 question from here.
Dave Kreskowiak wrote:
"C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe" /p /h "<fullpathtofilehere>"
What do you mean by /p and /h ? Because in my application, i did not use these two argument. I just access the acrobat executable file and run the file base on its path.
Dave Kreskowiak wrote:
C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe
If i install windows on Drive D: and my program file would be D:\Program Files and the code is fix to drive C: how could we write code that could check which is the system drive for our windows??? It contain an error if I use:
"%programfiles%\Adobe\Acrobat 6.0\Reader\AcroRd32.exe" "<fullPathToFileHere>"
Can you give me some solution?
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
The man from SCN-CO wrote:
What do you mean by /p and /h?
THese are command line parameters that Acrobot Reader uses to tell it to Hide itself (no visible form or interface) and Print the file specified on its command line.
The man from SCN-CO wrote:
If i install windows on Drive D: and my program file would be D:\Program Files and the code is fix to drive C: how could we write code that could check which is the system drive for our windows??? It contain an error if I use:
"%programfiles%\Adobe\Acrobat 6.0\Reader\AcroRd32.exe" ""
It's just an example. How you adapt the code is up to you. An example of getting the path to Program Files would be:
Dim path As String = Environment.GetFolderPath( Environment.SpecialFolder.ProgramFiles )
You could also read the Registry at the following key to find the complete path to AcroRd32.exe:
KHEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\5.0\InstallPath
or
KHEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\6.0\InstallPath
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, thank you Dave. I have to find another document about accessing the registry from vb.net before I work with this code.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi Dave, according to your comment and my research, now I found a document from http://www.codeproject.com/vb/net/registry_with_vb.asp[^] about accessing the registry. This will speed up my project, Thank you a lot
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hi out there!
I need your help! I am developing a Visio ActiveX application and I can not find the way to call another instance of my application. The ActiveX Drawing Control is a SDI, but I don't want two or more drawing controls in my application, just more instances. Can someone help me???
Thanx!
|
|
|
|
|
I've created a datagrid that pulls data from a sql database based on the option chosen in a dropdown. My problem is with the paging feature. If a result I choose shows pages 1 and 2, and I go to the second page then try to choose another option from the dropdown that shows a single page it blows up. The error message is: "Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount"
Is there anyway to reset the page index or page count so choosing a new option will take me back to page one? Thanks,
Ralph
|
|
|
|
|
Try to check the information from here[^], it might be give you some idea.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
hello..
this is the first time i'm developing client-server application
using VB and SQL server
now i'm testing the application with my server
the connection made with SQL Server using this
"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=dbDesa;Data Source=MSSYA"
the application will be ok in stand alone mode
i need to deploy the complete application to another server
so i assumed, the connection string above can't be used if the application install in another server
can somebody help me with the simple example to solve this
|
|
|
|
|
In my opinion, The Initial Catalog won't change but the Data Source might change base on the server name for each machine. As far as I know (local) variable is use to represent for each server name.
shaf_sar wrote:
"Provider=SQLOLEDB.1Persist Security Info=False;User ID=sa;Initial Catalog=dbDesa;Data Source=MSSYA"
So your code should become to:
"Provider=SQLOLEDB.Persist Security Info=False;User ID=sa;Initial Catalog=dbDesa;Data Source=(local)" or "Provider=SQLOLEDB.Persist Security Info=False;User ID=sa;Initial Catalog=dbDesa;Data Source=local"
Try to check at http://www.connectionstrings.com/[^] for more information. For your database in sql server try use sp_detach_db and sp_attach_db store procedure to deploy it to the other machine. If you have SQL server book online then you can choose have a look at it for reference.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
The man from SCN-CO wrote:
As far as I know (local) variable is use to represent for each server name.
A more typical way to represent it would be to use Data Source=. .
Having said that, if it's a client / server app, then it's unlikely that the datasource will be the local machine. What I typically do is form a connection string dynamically based on settings (usually stored in the registry), with a UI to allow Dumb users to sort it out. If i'm dealing with techies, I tend to use the Datalinks dialog for configuring connections:
<br />
Dim oDL as New Datalinks<br />
<br />
strConnectionString = oDL.PromptNew<br />
oConnection.Open strConnectionString<br />
<br />
which displays the DL dlg and returns the conn string - useful if not sure what users want to connect to, but does allow them to do silly things like form a conn string for Oracle on the local host, when they need SQLServer on a remote machine...but like I said - tend to reserve that for savvy users! Note that given a ADODB::Connection object, can also call PromptEdit, which makes the dlg default to the current settings....
In terms of deploying the DB, I tend not to use attach and detatch, but rather backup and restore to a different machine, or SQL Script the whole smash - swings and roundabouts really, but my preference....
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
RichardGrimmer wrote:
but does allow them to do silly things like form a conn string for Oracle on the local host, when they need SQLServer on a remote machine...
Yes, I also concern about this problem before. But now I have to make sure that the user choose the correct database. To do that, I have to check the structure of the database (the number of table and number fields) after the user have select the database. If it is wrong then let the user to choose another one.
A thousand mile of journey, begin with the first step.
APO-CEDC
Save Children Norway-Cambodia Office
|
|
|
|
|
Hello It's me again with another painstaking question. I am still working on the same database (In Access 2000) and am now trying to import an excel file. My problem is that the excel file has some special formating and extra crap I don't need and do not know how to get around, so it doesn't import. If need be I can email the excel file to anyone willing to help me. This excel file is updated by a third party every week so it will be an on going import and I would like to make it as easy as possible to do. I'm sorry I'm not to detailed it's a bit hard to explain without one seeing what I am trying to do.
If you would like me to email you the excel file please email me @
ri
p@
gh
os
tm
ai
l
.net
Sorry just trying to prevent spam bots.
Thank you in advance
|
|
|
|
|
Using the following code:
Private Sub LkSplitsGrid1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles LkSplitsGrid1.DragEnter<br />
If e.Data.GetDataPresent(DRAGITEM) Then<br />
e.Effect = DragDropEffects.Copy '(A)<br />
ElseIf e.Data.GetDataPresent(DRAGELEMENT) Then<br />
Try<br />
Dim c As LKVariable = CType(e.Data.GetData(DRAGELEMENT), LKVariable)<br />
e.Effect = DragDropEffects.Move '(B)<br />
Catch<br />
e.Effect = DragDropEffects.None<br />
End Try<br />
Else<br />
e.Effect = DragDropEffects.None<br />
End If<br />
End Sub
I wish to have the DragDropEffects to be set to "move" but if I set the first instance of it (A) to "move" the cursor won't change. If I set (A) to "copy" and (B) to "copy" the (B) code doesn't change the cursor, ie. it is is the "none" cursor. Why is that?
Rugby League: The Greatest Game Of All.
|
|
|
|
|
When you initiated the drag drop operation with the DoDragDrop, what effect(s) did you specify?
Cheers
Tom
|
|
|
|
|
Hi,
I am new to vb.net, actually i want to receive mail from my mail server in vb.net without using any third party utility(control). I heard that using sockets we can do. if you know anyother way to receive mail in vb.net, Could any one pls help me with code. It's urgent requirement for me.
My email id is jith_n@yahoo.com
Thanks,
J R
|
|
|
|
|
Hi.
I am just involved in writing a program (MUST BE IN VB6) that works with access databases.
I know what to do in order to get, set or update data.
My problem is to print some reports from the data.
I don't know wether I should make the report and it's form to be printed myself or there is some methods to generate a report like what is in access itself.
Thanks in advance
|
|
|
|
|
You could use the Data Report Designer.
If you use the Data Environment Designer to set up the data source, you can use the Report Designer to lay out the design of the report.
You would need the Add Data Report to appear on the Project menu. If it doesn't, do the following...
Open Components dialog box, click Designers tab, select Data Report.
Once you add the Data Report to your project, all you have to do is set its properties.
I hope this helps.
Larry Bray
|
|
|
|
|
Thank you Larry!
It was quite helpful.
|
|
|
|
|
I have tried ever thing under the sun and the moon and I don't get I am trying to write a code that counts the number charcters, number of words, number of sentences, and number paragrahgs contained in a string.
|
|
|
|
|
Huh?
Guess not understood your problem exactly, but:
using Len() function, you can find out number of characters inside a string. counting number of dots (.) you can find the number of sentences. counting the number of enters (chr(13)) you can find number of paragraphs.
(just there should be some verifications to see for example if a dot (.) is a dot in a number (2.34) or not or some other things. and it is easy to check)
I dunno if I have answered your question or not!
|
|
|
|
|
I’m having a hard time manipulating a string...
How can I remove everything to the left of a given string in a string?
Example:
‘This is my main string. It is always different’.
I want to trim everything to the left of ‘string.’ Including ‘string.’ So that my new string reads:
‘It is always different.’
The word ‘string.’ will always be part of the string.
Thanks
Brad
|
|
|
|