|
How about Marc Clifton's Outlook Bar[^]?
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
A very good outlook Bar here + other forms controls :
http://www.divil.co.uk/net/
|
|
|
|
|
A very good outlook Bar here + other forms controls :
http://www.divil.co.uk/net/
|
|
|
|
|
does someone know if its possible to send email in vba using smtp and winsock?
i got a code which works in vb.Using the code in vba seems to be possible
and also the refereces are in vba available but i always get the same message
"objectvariable or with-blockvariable not set"
what does it mean?
here is my complete code,
hope someone can help
Option Explicit
' ----------------------------------------------------------------------------
'
' EVENTS
'
' ----------------------------------------------------------------------------
Public Event Connected(ByVal Host As String, ByVal Port As Long)
Public Event ReceivedData(ByVal Data As String)
Public Event SentData(ByVal Data As String)
Public Event MailCompleted()
Public Event Error(ByVal Error As String)
' ------------------------------------------------------------------------------
'
' PROPERTY VARIABLES
'
' ------------------------------------------------------------------------------
Dim m_Server As String ' mail server host
Dim m_Port As String ' mail server port
Dim m_MailFrom As String ' from address
Dim m_MailTo As String ' to address
Dim m_BCC As String ' blind carbon copy addresses
Dim m_CCC As String ' carbon copy addresses
Dim m_Subject As String ' email subject
Dim m_NameFrom As String ' from name
Dim m_NameTo As String ' to name
Dim m_Body As String ' email body
Dim m_Log As String ' log of transaction
Dim Sock As Winsock
' private state variables
Dim LastResponse As String
' ------------------------------------------------------------------------------
'
' PUBLIC PROPERTIES
'
' ------------------------------------------------------------------------------
Public Property Get Server() As String
Server = m_Server
End Property
Public Property Let Server(ByVal Data As String)
m_Server = Data
End Property
Public Property Get Port() As String
Port = m_Port
End Property
Public Property Let Port(ByVal Data As String)
m_Port = Data
End Property
Public Property Get MailFrom() As String
MailFrom = m_MailFrom
End Property
Public Property Let MailFrom(ByVal Data As String)
m_MailFrom = Data
End Property
Public Property Get MailTo() As String
MailTo = m_MailTo
End Property
Public Property Let MailTo(ByVal Data As String)
m_MailTo = Data
End Property
Public Property Get BCC() As String
BCC = m_BCC
End Property
Public Property Let BCC(ByVal Data As String)
m_BCC = Data
End Property
Public Property Get CCC() As String
CCC = m_CCC
End Property
Public Property Let CCC(ByVal Data As String)
m_CCC = Data
End Property
Public Property Get Subject() As String
Subject = m_Subject
End Property
Public Property Let Subject(ByVal Data As String)
m_Subject = Data
End Property
Public Property Get NameTo() As String
NameTo = m_NameTo
End Property
Public Property Let NameTo(ByVal Data As String)
m_NameTo = Data
End Property
Public Property Get NameFrom() As String
NameFrom = m_NameFrom
End Property
Public Property Let NameFrom(ByVal Data As String)
m_NameFrom = Data
End Property
Public Property Get Body() As String
Body = m_Body
End Property
Public Property Let Body(ByVal Data As String)
m_Body = Data
End Property
Public Property Get Log() As String
Log = m_Log
End Property
Public Property Let Log(ByVal Data As String)
m_Log = Data
End Property
' ------------------------------------------------------------------------------
'
' PUBLIC SUBS
'
' ------------------------------------------------------------------------------
Public Function SendMail() As Boolean
Dim SMTPCommands(0 To 10) As String
Dim SMTPResponses(0 To 10) As String
Dim Success As Boolean
Dim i As Integer
' construct an array of commands
SMTPCommands(0) = "HELO " & Me.Server
SMTPCommands(1) = "MAIL FROM:" & Me.MailFrom
SMTPCommands(2) = "RCPT TO:" & Me.MailTo
SMTPCommands(3) = "DATA"
SMTPCommands(4) = "BCC:" & Me.BCC
SMTPCommands(5) = "CCC:" & Me.CCC
SMTPCommands(6) = "SUBJECT:" & Me.Subject
SMTPCommands(7) = "TO:" & Me.NameTo
SMTPCommands(8) = "FROM:" & Me.NameFrom & vbCrLf ' extra vbCrLf
SMTPCommands(9) = Me.Body & vbCrLf & "."
SMTPCommands(10) = "QUIT"
SMTPResponses(0) = "250"
SMTPResponses(1) = "250"
SMTPResponses(2) = "250"
SMTPResponses(3) = "354"
SMTPResponses(4) = ""
SMTPResponses(5) = ""
SMTPResponses(6) = ""
SMTPResponses(7) = ""
SMTPResponses(8) = ""
SMTPResponses(9) = "250"
SMTPResponses(10) = "221"
' connect to the server
If ConnectToServer = False Then
RaiseEvent Error("Couldn't connect to server")
Exit Function
Else
' wait for the welcome message to be received
WaitForResponse "220"
End If
' send each command, waiting for a response
For i = 0 To 10
' send the command
SMTPSend SMTPCommands(i)
' wait for the response
Success = WaitForResponse(SMTPResponses(i))
' check if we were successful
If Success = False Then
RaiseEvent Error("Failed at server side. Check the SMTP.Log property for more details")
Exit Function
End If
Next i
' finished
RaiseEvent MailCompleted
End Function
Private Function ConnectToServer() As Boolean
' connect to the host
Sock.RemoteHost = Me.Server
Sock.RemotePort = Me.Port
Sock.Connect
' wait for connection
Do While Sock.State <> sckConnected
DoEvents
If Sock.State = sckError Then
Exit Function
End If
Loop
' return true
ConnectToServer = True
End Function
Private Function WaitForResponse(ByVal Response As String) As Boolean
' if we're not waiting for a response then exit
If Response = "" Then
WaitForResponse = True
Exit Function
Else
' wait for the response property to change
Do While LastResponse = ""
DoEvents
Loop
' if it matches, return true, else return false
If Response = LastResponse Then
' return true
WaitForResponse = True
' check for errors
Else
WaitForResponse = False
End If
End If
' clear the static variable for next time
LastResponse = ""
End Function
Private Sub SMTPSend(ByVal Data As String)
' send the passed string with a vbCrLf
If Sock.State = sckConnected Then
Sock.SendData Data & vbCrLf
DoEvents
End If
' raise event
RaiseEvent SentData(Data)
' log
AppendLog Data & vbCrLf
End Sub
Public Sub AppendLog(ByVal Data As String)
' append the passed data to the log
Me.Log = Me.Log & Data
End Sub
' ------------------------------------------------------------------------------
'
' INTERNAL SUBS
'
' ------------------------------------------------------------------------------
Private Sub Sock_Connect()
' raise event
RaiseEvent Connected(Sock.RemoteHost, Sock.RemotePort)
End Sub
Private Sub Sock_DataArrival(ByVal bytesTotal As Long)
Dim Data As String
' grab the data and set the last response
Sock.GetData Data
LastResponse = Mid$(Data, 1, 3)
' raise event
RaiseEvent ReceivedData(Data)
' log
AppendLog Data
End Sub
Private Sub Sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
' raise event
RaiseEvent Error(Description)
End Sub
Private Sub UserControl_Resize()
' fit the control to the image
With UserControl
.Height = picImage.Height
.Width = picImage.Width
End With
End Sub
Private Sub UserForm_Click()
' display the form
'Me.Show
' setup the mail control
With SMTP
.Server = "mail.hotmail.com"
.Port = 25
.MailFrom = "testing@winsockvb.com"
.MailTo = "youremailhere@hotmail.com"
.NameFrom = "Me"
.NameTo = "You"
.Subject = "Test mail from WinsockVB.com control"
.Body = "Hello"
' send the mail
.SendMail
End With
End Sub
Thanx
|
|
|
|
|
Add a reference to the CDO com object and use CDO calls to exchange server.
There are several varieties of CDO calls so pick the one that suits your needs.
|
|
|
|
|
Hi,
I wanted to know if DataSet can be used as a Data Structure in Visual Basic.NET
|
|
|
|
|
I am near the end of a program. This program accesses rich text files and jpeg files using the app path method. This works well while the program is contained within the same folder as the files.
I want to have the compiled program in "program files" and have the program access the rt files and jp files from the cd rom no matter what drive letter is assigned to the rom.
Mark
|
|
|
|
|
I think you want to know which one is the CD-ROM drive :
use these APIs:
FindFirstVolume<br />
FindNextVolume to search volumes
and
GetVolumeInformation
to check file system..
|
|
|
|
|
after searching high and low i am unable to find anything in .net or 3rd parties for converting rtf or any text to postscript.
is there any classes in the .net framework that allows this to happen dynamically? i have an rtf interface application written in vb.net that i want to write out to postscript.
can anyone point me in a direction that will that the rtf to postscript?
joe
|
|
|
|
|
I'm trying to load an image file from a web server. The request simply fetches a file from an HTTP location that I know exists (it loads in IE).
However, when I run the program I get the following:
System.Net.WebException: The remote server returned an error: (407) Proxy Authentication Required.
I don't know of any changes to our ISA server, but I have SP4. Does anyone know how to fix this?
Lost
|
|
|
|
|
Hi
If i print a graphic created using .net code directly to the printer, it is very neat. But if I save the same as a BMP file and print the output is not as sharp... can anything be done to retain the sharpness
|
|
|
|
|
how can i change icon of my VB exe if it doesn't have any forms.
my app has no gui interface (only modules and classes)
any clues!
rIsHaBh
|
|
|
|
|
is it possible to set icon for executable (which has no forms/gui) without using any external add-ins
rIsHaBh
|
|
|
|
|
If I have an application that uses the FromFile("Pathname") method, how can that code recognize where to find that file on another computer.
For example, if I want to display a picture that I'm developing on my computer and I use the FromFile("C:\my Bitmaps\Pic.bmp") that's all fine and dandy.
But if I were to install that application on another computer, and when deployed, generically dumps every dependent file into "C:\Program Files\WindowsApplication1", the path I originally gave to find the Bitmap "C:\my Bitmaps\Pic.bmp" will no longer be valid.
How can I make it so that when the application is installed on another computer, all the paths will be correct?
Thank you
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
I am not sure I understood your question correcty, but:
1. If the user wants to open an arbitrary picture on your program, you can use the OpenFileDialog class to get the path and then use that path on Bitmap.FromFile() method.
2. If you are talking about a picture that you want to distribute with your program, install it in the same directory as your executable and use something like Application.StartupPath + "\pic.bmp" or embbed it in the executable.
|
|
|
|
|
I think the second option is the one I was looking for.
Let's say under the Form_Load event, I want the form to open up with a picture. On my computer, the picture is located at C:\my pics\Pic.bmp, but if I were to install this program at on another person's computer, it would install at the default location C:\Program Files\WindowsApplication1\Pic.bmp, and when he would try to run the program, it would not find the picture because my code is looking for C:\my pics\Pic.bmp, not the other path.
So instead of using BitMap.Fromfile("Path") just use Application.StartupPath & "\Pic.bmp" ?
Also, how could I embed a picture or a WAV into the executable?
thanks
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
I think the second option is the one I was looking for.
Let's say under the Form_Load event, I want the form to open up with a picture. On my computer, the picture is located at C:\my pics\Pic.bmp, but if I were to install this program at on another person's computer, it would install at the default location C:\Program Files\WindowsApplication1\Pic.bmp, and when he would try to run the program, it would not find the picture because my code is looking for C:\my pics\Pic.bmp, not the other path.
So instead of using BitMap.Fromfile("Path") just use Application.StartupPath & "\Pic.bmp" ?
Also, how could I embed a picture or a WAV into the executable?
thanks
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
If you include that Bitmap in the project directory, you can then include it in your project and select Build Action to embedded resource in the properties window.
To retrieve the embedded bitmap you would use the overloaded constructor Bitmap(Type type, string resource), where the parameters type would be ME.GetType() and resource would be "myBitmap.bmp".
If you choose the Build Action as content, it will be installed in your program's directory in the user's computer and you can use a relative path to it: Bitmap(string path) where path is just the full name (myBitmap.bmp).
As to the wave file, it can also be embeded if you include it in the project and set the build action to embeded. Then to retrieve it, the only option I see is to retrieve it as a raw stream (using the GetManifestResourceStream, for instance), but maybe there some other way to retrieve it that I am not aware of.
|
|
|
|
|
Thanks A lot! The application.StartupPath namespace worked like a charm!
The Jazz Master 6000
DJ Badknees
Parma Grind Crew - www.geocities.com/parmagrindcrew
|
|
|
|
|
Hello everybody...
i need help in running applications other than exe files using visual basic 6.0 i.e. if i want to open a .doc document using visual basic depending on the user chosen from the open dialog box not statically
shell("c:\program files\office\word.exe c:\mydoc.doc") this opens always the same document..
this is not what i need. i want the user to browse his computer for certain files extensions on his harddrive and when he chooses the file it opens.
P.S. the program must work for only one extension...
thank you very much
adnan madi
|
|
|
|
|
in vb6 :
Add the Microsoft Common Dialog Control to the components
then add the control to the form
CommonDialog1.Filter = "Doc|*.doc"<br />
CommonDialog1.ShowOpen<br />
<br />
shell c:\program files\office\word.exe" & CommonDialog1.FileName
you better also check if the user click cancel by checking the length of CommonDialog1.FileName
|
|
|
|
|
Hi
I'm trying to access a sequence which is part of a node in an XML file.
<br />
<property pr_ref="ABC" ... ><br />
<sellingpoint text="HALLWAY" /><br />
<sellingpoint text="DINING ROOM" /><br />
<sellingpoint text="KITCHEN" /><br />
</property><br />
I can iterate through the "property" nodes and retrieve their columns (pr_ref) but how on earth do I access the sequence of selling points? I've tried childrows and parents rows and I'm lost!
I'm using VB.NET and I have the entire file in a DataSet. The second table of the dataset seems to contain ALL of the sellingpoint rows, not just those related to the one property.
I'm desperate!
Bernhard
Don't worry, nobody lives forever.
|
|
|
|
|
The DataSet will load the different levels of nodes into seperate tables, but will create relationships between those tables for you. The property table that is created in the DataSet should have a relationship to the sellingpoint table, which could be accessed through the DataSet.Tables(0).ChildRelations collection. Using this DataRelation, you can access the sellingpoint children of a property row by doing DataSet.Tables(0).Rows(0).GetChildRows(DataRelation).
There are other ways to do this as well. Just take a look at the help for DataSet and DataTable for more information. Or, to get an idea of exactly what is in your DataSet after loading the XML, set a breakpoint in your code, and do a QuickWatch (right click on an object after breaking into code during debug of your application) of your DataSet.
|
|
|
|
|
Hi,
I hv an application that need user to key in value for 2 text box. After that i will bind data to combo box based on the values of text boxes. However, i don't hv a button to trigger that binding process. I want to perform this process in combo box click event. But i hv to click the combo box twice. How to make user only click combo box once and then the value will directly pop out in combo box?
Private Sub cbSubconRoute_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cbSubconRoute.Click
If (txtN.Text = "" Or txtC.Text = "") Then
lblTxnStatus.Text = "Please Key In NSID And NSSPEC!"
Return
End If
If (cbSubconRoute.Items.Count < 1) Then
bindDataForComboBox()
End If
End Sub
Private Sub bindDataForComboBox()
cbSubconRoute.Items.Add("")
cbSubconRoute.Items.Add(txtN.Text)
cbSubconRoute.Items.Add(txtC.Text)
cbSubconRoute.Refresh()
End Sub
|
|
|
|
|
I don't think you're not going to be able to do it that way. Why not add an event to the text boxes that checks if they both have text in and populate the combo box then? or maybe populate the text box on the Mouse_over event of the combo box?
Beware the chickens, for in their silence, they plot...
Life is too short to be taken seriously.
-- Oscar Wilde
|
|
|
|