Even though this example was intended to be simple, the overall concept may be used within an application to do some seemingly complex jobs. You may wish to build the solution and test it. ' Upon user’s request, close the applicationĪt this point, the application should be complete. Object, _īyVal e As System.EventArgs) Handles btnExit.Click MessageBox.Show(ex.StackTrace, ex.Message, _Įnd Try End Sub Private Sub btnExit_Click( ByVal sender As System. MessageBox.Show( " The mail message has been sent to " & _ MySmtpClient.UseDefaultCredentials = True Try Dim message As New MailMessage(mFrom, mTo, mSubject, mMsg)ĭim mySmtpClient As New SmtpClient(mMailServer) ' Within a try catch, format and send the message to ' the recipient. ' Collect user input from the form and stow content into ' the objects member variables Object, _īyVal e As System.EventArgs) Handles btnSend.Click ' set up the carriers list - this is a fair list, ' you may wish to research the topic and add others, ' it took a while to generate this list.Ĭ( " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " " Sub Private Sub btnSend_Click( ByVal sender As System. Object, _īyVal e As System.EventArgs) Handles MyBase.Load Private Sub frmMain_Load( ByVal sender As System. The following imports were added to the top of the class:
Att send sms from pc code#
The following figure (Figure 1) shows a properly configured collection of input fields in use:įigure 1: The Demonstration Application in UseĪ quick review of the code will reveal that there is little going on there. To maintain the simplicity of the project, little in the way of error handling has been included.
The application is simple, but could easily be improved by validating each of the required fields through the use of regular expressions or by at least validating that the text associated with each of the text boxes is not an empty string.
Att send sms from pc windows#
The main form is a Windows application form, and it contains a few controls necessary to capture the fields needed to properly form the message. Within the project, you will find one main class: frmMain.vb. In order to begin, unzip the downloaded files and open the project provided. The source code provided includes a relatively good list of carriers to simplify the task of connecting with a cell phone, and the task itself is really no more difficult than sending an email message through a desktop or web based application. This article describes a simple way to send text messages to a cellular phone from within a VB.NET desktop application.