|
The PrintPage event is fired for each and every page that gets printed. Your code sample is a bit incomplete, but it looks like you're printing the same thing on every page. Are you printing only what fits on a page, saying the point in the loop that you're at and restarting the loop at the point you saved in the previous handling of the PrintPage event.
|
|
|
|
|
Hi there, I'm trying to migrate an existing vb6 mail application to vb 2008 but it fails conversion. Anyway I'm looking for a module to send email with attachments using outlook 2003. Code must be written in vb 2008. What I can't get is attaching a document to the email! What I have so far is:
Module Module1
Dim app As Object
Dim itm As Object
Dim myItem As Object
Dim myAttachments As Object
Sub sendmail()
app = CreateObject("Outlook.Application")
itm = app.CreateItem(0)
With itm
.To = "someone@yahoo.com"
.CC = "someone@hotmail.com"
.Subject = "test"
'.importance = "high"
'.BodyFormat = Microsoft.Office.Interop.OutlookolFormatHTML
.Body = "Test message"
.send()
End With
MsgBox("message sent", vbOKOnly, "sent....")
End Sub
End Module
All I do is call the sendmail() function from a cmd button! There are other example send mail applications out there but they are written in vb.net and uses smtp(which I don't need)
|
|
|
|
|
I'm pretty sure that itm should have an attachment property.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I hope it did, but vb2008 is different from vb6 (which had the attachment property).
|
|
|
|
|
It doesn't matter. The object you're using are not exposed by VB6 or VB.NET. They are exposed by the COM-based classes you are creating instances of. The properties would be identical.
|
|
|
|
|
I use this
Dim oMail As System.Net.Mail.MailMessage
Dim oFrom As System.Net.Mail.MailAddress
Dim oSmtp As System.Net.Mail.SmtpClient
oMail = New System.Net.Mail.MailMessage
oFrom = New System.Net.Mail.MailAddress("me@here.com")
oSmtp = New System.Net.Mail.SmtpClient("mail.here.com")
oMail.From = oFrom
oMail.To.Add("him@here.com, him@there.com, another@there.com)
oMail.Subject = "My Subject"
oMail.Priority = Net.Mail.MailPriority.Normal
oMail.IsBodyHtml = True
oMail.Body = "Body of rmail here"
oSmtp.Send(oMail)
|
|
|
|
|
Does this piece of code require you to setup an smtp server in IIS? If it does, then this piece of code will not work in my case. All I want to do is send an email with an attachment via outlook 2003 (connects to microsoft exchange) and the code needs to be compatible with vb2008.
My first post has working code (in vb2008) that can send email with outlook 2003, BUT without attachments!
|
|
|
|
|
I guess all you need to add is this line
<br />
.Attachments.Add("c:\myfolder\myfile.txt")
But this gives me security warning.
I will try to find how to avoid it.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
I have now switch to office 2007 and adding these lines worked perfectly:
' Add an attachment
Dim sSource As String = "C:\somefile.extension"
Dim sBodyLen As String = oMsg.Body.Length
Dim sDisplayName As String = ""
Dim oAttachs As Outlook.Attachments = oMsg.Attachments
Dim oAttach As Outlook.Attachment
oAttach = oAttachs.Add(sSource, , , sDisplayName)
oMsg.Send()
|
|
|
|
|
how to create round shapes??
could this work-
in a label(backcolor set equal to form's) set a round image.
won't this increase the cpu time??
i am looking for an efficient way to create a round shape
like in vb6 we'd just chose the shape control.
but in vb2008 all controls that don't have handles are dropped
is there a way to do so??
eh?
TheMrProgrammer
|
|
|
|
|
System.Drawing.Graphics provides the facility to create diffrent types of shape as you want.
Set your Backcolor as forms color or set it to transparent.
If you can think then I Can.
|
|
|
|
|
Or you can Google for the "VB.NET Power Packs". The 3.0 version has shape controls in it like those that used to be in VB6.
|
|
|
|
|
hi
modified 28-Nov-12 8:23am.
|
|
|
|
|
|
Using cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DB\E_Ensemb.mdb")
check this
remove only the ; from the end
|
|
|
|
|
I need to directly connect to the .dbf files and not with the .mdb files...
|
|
|
|
|
.dbf is DBase file which belong to VFP (Visual Foxpro)
I use this to connect
Dim _cnn As New OleDb.OleDbConnection("Provider=VFPOLEDB.1;Data Source=F:\myfolder\myfile.dbf")
If you don't have VFPOLEDB in your ODBC, install the driver from here
Microsoft OLE DB Provider for Visual FoxPro 9.0[^]
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
|
Thanks to all who replied.
The links really helped.
|
|
|
|
|
The value of w doesnt increase or decrease once it reaches the value 2 .. can someone please tell me why..
Thanks in advance
<br />
Public Class Form1<br />
Dim g As Graphics<br />
Dim db As Boolean<br />
Dim x As Integer = 100<br />
Dim y As Integer = 100<br />
Dim w As Integer = 150<br />
Dim h As Integer = 150<br />
<br />
<br />
Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel<br />
Console.WriteLine(e.Delta.ToString)<br />
If (e.Delta > 0) Then<br />
Console.WriteLine("in zoomin")<br />
w = w * (e.Delta / 100)<br />
Console.WriteLine("inside zoomin e.delta " & e.Delta.ToString)<br />
Console.WriteLine("w" & w)<br />
h = h * (e.Delta / 100)<br />
End If<br />
If (e.Delta < 0) Then<br />
Console.WriteLine("zoomout")<br />
w = w / ((e.Delta * -1) / 100)<br />
h = h / ((e.Delta * -1 / 100))<br />
<br />
End If<br />
Console.WriteLine("w" & w)<br />
Me.Refresh()<br />
End Sub<br />
<br />
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint<br />
<br />
e.Graphics.DrawRectangle(Pens.Black, x, y, w, h)<br />
End Sub<br />
<br />
End Class<br />
<br />
|
|
|
|
|
I suspect the answer is that even if VB doesn't round e.Delta/100 to an int, once it rounds the end result to an int, it's going to not be big enough to get past 2 in either direction. Do e.Delta / 100.0 to make it work with a float, and consider what you do when the end result moves the value by less than .5, which means it will round back to what it was. Perhaps you need to store w as a float, and make it an int only when you're using it to draw with.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Public Class Form1
Dim g As Graphics
Dim db As Boolean
Dim x As Integer = 100
Dim y As Integer = 100
Dim w As Integer = 150
Dim h As Integer = 150
Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
Console.WriteLine(e.Delta.ToString)
If (e.Delta > 0) Then
Console.WriteLine("in zoomin")
w = IIf((w * (e.Delta / 100)) < 3, 3, (w * (e.Delta / 100)))
'w = w * (e.Delta / 100)
Console.WriteLine("inside zoomin e.delta " & e.Delta.ToString)
Console.WriteLine("w" & w)
h = IIf((h * (e.Delta / 100)) < 3, 3, (h * (e.Delta / 100)))
'h = h * (e.Delta / 100)
End If
If (e.Delta < 0) Then
Console.WriteLine("zoomout")
w = w / ((e.Delta * -1) / 100)
h = h / ((e.Delta * -1 / 100))
End If
Console.WriteLine("w" & w)
Me.Refresh()
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.DrawRectangle(Pens.Black, x, y, w, h)
End Sub
End Class
dinvit83
|
|
|
|
|
Not very efficient, but it works. I prefer to lead people to water, rather than throw water at them.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian Graus wrote: lead people to water, rather than throw water at them
Remind me never to spontaneously combust around you!!
|
|
|
|
|
Previously my code was working perfectly fine but suddenly showing up this error Unable to write data to the transport connection:An existing connection was forcibly closed by the remote host; whenever i try to write something on the network stream. Following is the code i am using right now:
Dim PacketSize As Integer = 8192
Dim client As New TcpClient
client.Connect(IPAddress.Parse("192.168.15.51"), 7771)
Dim ns As NetworkStream = client.GetStream
Dim fs As New FileStream(FileName, FileMode.Open, FileAccess.Read)
Dim buffer(PacketSize - 1) As Byte
Dim i As Integer
i = fs.Read(buffer, 0, PacketSize)
While i <> 0
ns.Write(buffer, 0, i) <-- this line cause the error
i = fs.Read(buffer, 0, PacketSize)
End While
fs.Close()
ns.Close()
There's no anti-virus or firewall on target machine. I've even turned window's firewall off. Do i have to start any service on the target machine which somehow stopped??? I've searched everywhere but didn't find solution. Please help.
AliAmjad(MCP)
First make it Run THEN make it Run Fast!
modified on Tuesday, May 5, 2009 2:13 AM
|
|
|
|