|
Hi,
Who can I send email with an attachment?
This is the code witchh I use but it don't work. Something missing?
Dim oMsg As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
oMsg.From = "noone@nobody.com"
oMsg.To = "someone@somewhere.com"
oMsg.Subject = "Email with Attachment Demo"
oMsg.Body = "This is the main body of the email"
Dim oAttch As MailAttachment = New MailAttachment("C:\myattachment.zip")
oMsg.Attachments.Add(oAttch)
SmtpMail.Send(oMsg)
Please help me!
Thanx anyway.
|
|
|
|
|
If you intend to send many e-mails and with more functionality than is included in .NET framework, you should look at the Indy project .
Regards,
Tadej
|
|
|
|
|
You didn't set the smtp sever property.
What error are you getting?
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
I am trying to run a vb6 compiled program on a public drive of a network. The program need access to a data base and when the dataenvironement (yes old but this is how I learnt to do things!) attemps to open the programme throws up this error and crashes.
HOWEVER it only does this when other users on the network attemt to run the file, when I do everything is fine. I have Network Manager privilages on the network and perhaps this is the reason.
Is there anyway I can get rid of this bug?
Thanks
°[Halo]°
Project Basilisk
|
|
|
|
|
713 is "Class not registered". Your VB6 app is using a COM class that exists on your machine, but on the machines of the other people trying to run your application. These other people would have to install the missing .DLL's or .OCX's that your app requires.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
This is not the problem though because if I run the programme on the machines under my own username then it works fine confused:
°[Halo]°
Project Basilisk
|
|
|
|
|
Assuming your trying to connect to an Access database, it would appear that the database your trying to connect to is only visible under your account. Check to make sure that the normal users can see the .MDB file your trying to open.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all,
I have a crystal report which has the box object with rounded corners. When i try to view it through the Crystal Report Viewer using VB.Net, the text disappears in the box object.
But if i remove the rounding, everything looks fine.Searched google and came to know this is a bug in .NET and was asked to install service pack. But i am not clear which service pack solves this issue as i have the latest one installed on my machine.
Please help if you know anything abt this.
Thanks
|
|
|
|
|
if i want to get the type of file and myfilename are returned in string variable how can i get type of file.Someone please help me out.
Raheel Iqbal
|
|
|
|
|
????
What's the type of a file?
|
|
|
|
|
it can be (.doc,.pdf,.xls,ppt etc...)
Raheel Iqbal
|
|
|
|
|
That's the extension of the file.
Anyway what you're looking for is provided directly by one of the FW classes specifically this method:
System.Io.Path.GetExtension
For full details have a look at this reference in the Help.
-- modified at 6:14 Tuesday 22nd November, 2005
|
|
|
|
|
Thank you very much your response working. thanks alot
Raheel Iqbal
|
|
|
|
|
Hello to all of you. Many of you reading this message helped me a lot of times. So you all know I'm pretty much a beginner in C++. However, I try to do my best to help everybody with what I know. Some time a go I promised I'll make an article about linking C++ with VB, inter process communication kind of thing, even though this time it's about a DLL and an Application, it still applies to the category.
So, without further delay, I invite you all to take a look at my article, I hope you'll find one or two interesting things there. Thank you all again for being here helping people like myself.
http://www.thecodeproject.com/threads/InterProcessCommunication.asp[^]
In less than 2 months I'll also release the first public beta for the freeware application I've been working on. Many of you helped me at it and you'll all find yourselves at the "Thanks to" section, as I am not one that forgets those who helped.
A nice day (or a good night) to y'all.
-= E C H Y S T T A S =-
The Greater Mind Balance
|
|
|
|
|
hi guys can any one of you tell me that how can i print these file of document... i m using the coding below to print these files its working fine but the 2 problems i m facing here. 1. if i want to print numbers of copies of one file how can i do,like i have (book.xls) file and i want to print 5 copies of this document how can i do and second problem is that its open the application i dont want to open it... like if i want to print .xls file it open Ms Excel application but i wont. How can i solve these errors please someone help me out its urgent.
Coding.
Dim p As Process = New Process
p.StartInfo.FileName = filePath.ToString()
p.StartInfo.CreateNoWindow = False
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal
p.StartInfo.Verb = "Print"
p.Start()
p.Dispose()
Raheel Iqbal
|
|
|
|
|
The method you are using here will start the application which is associated with the filetype in FileName .
What you should be doing is create an instance of the application's automation object (which won't show the UI) and then use that object's methods to manipulate the file as appropriate.
Something like this... but beware this code is not complete - you'll need to do some further research for the exact sequence etc. but you get the idea...
Dim ExcelApp As Microsoft.Office.Interop.Excel.Application
ExcelApp = New Microsoft.Office.Interop.Excel.Application
ExcelApp.Visible = False
ExcelApp.Workbooks.Open(filePath.ToString())
ExcelApp.Worksheets.PrintOut(...)
Don't forget to include a reference to the Microsoft Excel 11.0 Object Library (from Project -> References -> COM tab etc...).
...Steve
|
|
|
|
|
ok ill try it but what should i do for .doc and pdf format acutally it doesnot open the application for .ppt format but it does for three(.doc,.xls,.pdf). do you have any general idea?.
actually i have to print the document without open any windows printing window.
Raheel Iqbal
|
|
|
|
|
Use the correct automation object for each type of file: e.g. .doc and .pdf (?) = Word.Application; .ppt = PowerPoint.Application.
The basic idea is given in my earlier response. You'll need to read up on the methods of each object (should be fairly similar) to find out how to achieve your requirements.
...Steve
|
|
|
|
|
Dim Wordapp As Microsoft.Office.Interop.Word.Application
Wordapp = New Microsoft.Office.Interop.Word.Application
Wordapp.Visible = False
Wordapp.Documents.Open(filePath.ToString())
Wordapp.PrintOut(, , , , , , , 2, , , , , filePath.ToString())
Wordapp.Quit()
hi steve.
for (.doc) file i use this coding but by using this i m facing the same problem that it opens the doc application, will you please see this and guide me if you have any knowledge, and i did`nt find any class for acrobat file... will you please guide me some.
Raheel Iqbal
|
|
|
|
|
raheeli wrote: i m facing the same problem that it opens the doc application,
Hmmm... works for me without showing the UI (I'm using Office 11 objects). Do you mean that it is starting an instance of WINWORD.EXE as shown in the Task Manager? If so that is correct since that EXE is required to perform the printing of the specified document.
However I'd change this line:
Wordapp.PrintOut(, , , , , , , 2, , , , , filePath.ToString()<br />
to this:
Wordapp.PrintOut(, , , , , , , 2)<br />
otherwise you'll be probably printing to a file rather than the printer - and overwrite the input file in the process.
As far as PDF files are concerned, there is no COM object similar to that provided for the Microsoft applications that I know about to do what you want but I did find this via a Google search re: Acrobat commandline options to automate the print process.
[From the DEVFAQ]<br />
AcroRd32.exe filename - Executes the Reader and displays a file..<br />
AcroRd32.exe /p filename - Executes the Reader and prints a file..<br />
AcroRd32.exe /t path printername drivername portname - Initiates Acrobat<br />
Reader,,<br />
prints a file while suppressing the Acrobat print dialog box,then terminates<br />
Reader.<br />
The four parameters of the /t option evaluate to<br />
path,printername,drivername,and<br />
portname (all strings).<br />
printername - The name of your printer..<br />
drivername - Your printer driver 's name.Whatever appears in the Driver Used<br />
box<br />
when you view your printer 's properties.<br />
portname - The printer 's port.portname cannot contain any "/"characters;if<br />
it does,<br />
output is routed to the default port for that printer.<br />
If using Acrobat,substitute Acrobat.exe in place of AcroRd32.exe in the<br />
command lines.<br />
...Steve
|
|
|
|
|
Thanks steve you help me alot,really and its worthy for me.
Steve is there any General method by which i can solve my problem, it become head ache for me cause, as per requriement of format of printing increase i have to work out on that(now i had requirements of TIFF, JPEG, etc....) and may be in future it increases, do you have any general solution?
Actually i have to made a printing solution in which user can enter the number of copies and select the files, which he want to print. but no any operating system printing window should open.
Thankyou very much steve. please if you have any solution the reply me as soon as you can.
Raheel Iqbal
|
|
|
|
|
As far as I'm aware you need to open the correct application for the type of file you want to print, and then print via that application. Your code needs to do this.
I did a Google search for "automate printing files different formats" and found this hit in the results: http://www.silentprint.com/[^] which is a ready-built application for what you are attempting to do. This will save you a heap of headaches. However if you must do this code yourself (i.e. for project/assignment or other reasons) then you'll need to have your own code be aware of all the types of documents likely to be printed and handle them accordingly.
Note - I do not have any interest in the company or product referenced above. I simply found it as one of the hits on Google. There are others that you may want to check out.
...Steve
|
|
|
|
|
Thanks steve. but this is my project/assignemnt i can not use this product anyways will try to find from other links thanx once again you help me alot if you find any other solution... please let me know
Raheel Iqbal
|
|
|
|
|
Does anyone have a decent pizza ordering program out there. I'm trying to build one as we speak, having no luck
|
|
|
|
|
Are you trying to start a pizza shop, or is this homework ?
Christian Graus - Microsoft MVP - C++
|
|
|
|