DB的部分无法上传,仅给出源代码,内含前面的grps发短信以及邮件发送的部分。
------------------------vb.net源码(c#短信部分测试未通过不贴了)------------------------------------------------
Imports System.DataImports System.Net.SocketsImports System.IOImports System.Web.MailImports System.ThreadingImports System.Data.OleDbPublic Class Form1 Inherits System.Windows.Forms.Form Dim NetStream As NetworkStream Dim RdStrm As StreamReader Dim POPClient As TcpClient Dim SData As Byte() Dim Data As String Dim Bool As Boolean = True Public Shared strIn As String = "" Dim Out_STR As String Private dtOrderList As DataTable#Region " Windows 窗体设计器生成的代码 "
Public Sub New() MyBase.New()
'该调用是 Windows 窗体设计器所必需的。 InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。 Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub
'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents TabControl1 As System.Windows.Forms.TabControl Friend WithEvents TabPage1 As System.Windows.Forms.TabPage Friend WithEvents TabPage2 As System.Windows.Forms.TabPage Friend WithEvents TabPage3 As System.Windows.Forms.TabPage Friend WithEvents TabPage4 As System.Windows.Forms.TabPage Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents Label5 As System.Windows.Forms.Label Friend WithEvents tx_pop As System.Windows.Forms.TextBox Friend WithEvents tx_smtp As System.Windows.Forms.TextBox Friend WithEvents tx_user As System.Windows.Forms.TextBox Friend WithEvents tx_pass As System.Windows.Forms.TextBox Friend WithEvents tx_mailfrom As System.Windows.Forms.TextBox Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Status As System.Windows.Forms.ListBox Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox Friend WithEvents Label6 As System.Windows.Forms.Label Friend WithEvents Label7 As System.Windows.Forms.Label Friend WithEvents Label8 As System.Windows.Forms.Label Friend WithEvents Label9 As System.Windows.Forms.Label Friend WithEvents Label10 As System.Windows.Forms.Label Friend WithEvents Label11 As System.Windows.Forms.Label Friend WithEvents Label12 As System.Windows.Forms.Label Friend WithEvents Label13 As System.Windows.Forms.Label Friend WithEvents Label14 As System.Windows.Forms.Label Friend WithEvents Label15 As System.Windows.Forms.Label Friend WithEvents Label16 As System.Windows.Forms.Label Friend WithEvents Label17 As System.Windows.Forms.Label Friend WithEvents t_port As System.Windows.Forms.TextBox Friend WithEvents t_rate As System.Windows.Forms.TextBox Friend WithEvents t_bytesize As System.Windows.Forms.TextBox Friend WithEvents t_stopbyte As System.Windows.Forms.TextBox Friend WithEvents cbPro As System.Windows.Forms.ComboBox Friend WithEvents cbReadM As System.Windows.Forms.ComboBox Friend WithEvents Label18 As System.Windows.Forms.Label Friend WithEvents txReadLen As System.Windows.Forms.TextBox Friend WithEvents textBox5 As System.Windows.Forms.TextBox Friend WithEvents textBox4 As System.Windows.Forms.TextBox Friend WithEvents textBox3 As System.Windows.Forms.TextBox Friend WithEvents textBox2 As System.Windows.Forms.TextBox Friend WithEvents comboBox2 As System.Windows.Forms.ComboBox Friend WithEvents comboBox1 As System.Windows.Forms.ComboBox Friend WithEvents Label19 As System.Windows.Forms.Label Friend WithEvents textBox1 As System.Windows.Forms.TextBox Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Button4 As System.Windows.Forms.Button Friend WithEvents Label20 As System.Windows.Forms.Label Friend WithEvents tx_mail1 As System.Windows.Forms.TextBox Friend WithEvents tx_mail2 As System.Windows.Forms.TextBox Friend WithEvents tx_mail3 As System.Windows.Forms.TextBox Friend WithEvents Label21 As System.Windows.Forms.Label Friend WithEvents Label22 As System.Windows.Forms.Label Friend WithEvents Label23 As System.Windows.Forms.Label Friend WithEvents Label24 As System.Windows.Forms.Label Friend WithEvents Label25 As System.Windows.Forms.Label Friend WithEvents Button5 As System.Windows.Forms.Button Friend WithEvents Button6 As System.Windows.Forms.Button Friend WithEvents tx_limit As System.Windows.Forms.TextBox Friend WithEvents tx_time As System.Windows.Forms.TextBox Friend WithEvents tx_phone3 As System.Windows.Forms.TextBox Friend WithEvents tx_phone2 As System.Windows.Forms.TextBox Friend WithEvents tx_phone1 As System.Windows.Forms.TextBox Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid Friend WithEvents Button7 As System.Windows.Forms.Button Friend WithEvents Button8 As System.Windows.Forms.Button Friend WithEvents com As AxMSCommLib.AxMSComm Friend WithEvents AxMSComm1 As AxMSCommLib.AxMSComm Friend WithEvents Timer1 As System.Windows.Forms.Timer Friend WithEvents Dataset11 As Htemp.Dataset1 <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1)) Me.TabControl1 = New System.Windows.Forms.TabControl Me.TabPage1 = New System.Windows.Forms.TabPage Me.Status = New System.Windows.Forms.ListBox Me.Button2 = New System.Windows.Forms.Button Me.Button1 = New System.Windows.Forms.Button Me.tx_mailfrom = New System.Windows.Forms.TextBox Me.tx_pass = New System.Windows.Forms.TextBox Me.tx_user = New System.Windows.Forms.TextBox Me.tx_smtp = New System.Windows.Forms.TextBox Me.tx_pop = New System.Windows.Forms.TextBox Me.Label5 = New System.Windows.Forms.Label Me.Label4 = New System.Windows.Forms.Label Me.Label3 = New System.Windows.Forms.Label Me.Label2 = New System.Windows.Forms.Label Me.Label1 = New System.Windows.Forms.Label Me.TabPage2 = New System.Windows.Forms.TabPage Me.GroupBox2 = New System.Windows.Forms.GroupBox Me.AxMSComm1 = New AxMSCommLib.AxMSComm Me.Button4 = New System.Windows.Forms.Button Me.textBox1 = New System.Windows.Forms.TextBox Me.Label19 = New System.Windows.Forms.Label Me.comboBox1 = New System.Windows.Forms.ComboBox Me.comboBox2 = New System.Windows.Forms.ComboBox Me.textBox5 = New System.Windows.Forms.TextBox Me.textBox4 = New System.Windows.Forms.TextBox Me.textBox3 = New System.Windows.Forms.TextBox Me.Label12 = New System.Windows.Forms.Label Me.Label13 = New System.Windows.Forms.Label Me.Label14 = New System.Windows.Forms.Label Me.Label15 = New System.Windows.Forms.Label Me.Label16 = New System.Windows.Forms.Label Me.textBox2 = New System.Windows.Forms.TextBox Me.Label17 = New System.Windows.Forms.Label Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.com = New AxMSCommLib.AxMSComm Me.Button3 = New System.Windows.Forms.Button Me.txReadLen = New System.Windows.Forms.TextBox Me.Label18 = New System.Windows.Forms.Label Me.cbReadM = New System.Windows.Forms.ComboBox Me.cbPro = New System.Windows.Forms.ComboBox Me.t_stopbyte = New System.Windows.Forms.TextBox Me.t_bytesize = New System.Windows.Forms.TextBox Me.t_rate = New System.Windows.Forms.TextBox Me.Label11 = New System.Windows.Forms.Label Me.Label10 = New System.Windows.Forms.Label Me.Label9 = New System.Windows.Forms.Label Me.Label8 = New System.Windows.Forms.Label Me.Label7 = New System.Windows.Forms.Label Me.t_port = New System.Windows.Forms.TextBox Me.Label6 = New System.Windows.Forms.Label Me.TabPage3 = New System.Windows.Forms.TabPage Me.Button6 = New System.Windows.Forms.Button Me.Button5 = New System.Windows.Forms.Button Me.Label25 = New System.Windows.Forms.Label Me.tx_limit = New System.Windows.Forms.TextBox Me.Label24 = New System.Windows.Forms.Label Me.Label23 = New System.Windows.Forms.Label Me.tx_time = New System.Windows.Forms.TextBox Me.Label22 = New System.Windows.Forms.Label Me.tx_phone3 = New System.Windows.Forms.TextBox Me.tx_phone2 = New System.Windows.Forms.TextBox Me.tx_phone1 = New System.Windows.Forms.TextBox Me.Label21 = New System.Windows.Forms.Label Me.tx_mail3 = New System.Windows.Forms.TextBox Me.tx_mail2 = New System.Windows.Forms.TextBox Me.tx_mail1 = New System.Windows.Forms.TextBox Me.Label20 = New System.Windows.Forms.Label Me.TabPage4 = New System.Windows.Forms.TabPage Me.Button8 = New System.Windows.Forms.Button Me.Button7 = New System.Windows.Forms.Button Me.DataGrid1 = New System.Windows.Forms.DataGrid Me.Timer1 = New System.Windows.Forms.Timer(Me.components) Me.Dataset11 = New Htemp.Dataset1 Me.TabControl1.SuspendLayout() Me.TabPage1.SuspendLayout() Me.TabPage2.SuspendLayout() Me.GroupBox2.SuspendLayout() CType(Me.AxMSComm1, System.ComponentModel.ISupportInitialize).BeginInit() Me.GroupBox1.SuspendLayout() CType(Me.com, System.ComponentModel.ISupportInitialize).BeginInit() Me.TabPage3.SuspendLayout() Me.TabPage4.SuspendLayout() CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Dataset11, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'TabControl1 ' Me.TabControl1.Controls.Add(Me.TabPage1) Me.TabControl1.Controls.Add(Me.TabPage2) Me.TabControl1.Controls.Add(Me.TabPage3) Me.TabControl1.Controls.Add(Me.TabPage4) Me.TabControl1.Location = New System.Drawing.Point(16, 16) Me.TabControl1.Name = "TabControl1" Me.TabControl1.SelectedIndex = 0 Me.TabControl1.Size = New System.Drawing.Size(472, 392) Me.TabControl1.TabIndex = 0 ' 'TabPage1 ' Me.TabPage1.BackColor = System.Drawing.SystemColors.Control Me.TabPage1.Controls.Add(Me.Status) Me.TabPage1.Controls.Add(Me.Button2) Me.TabPage1.Controls.Add(Me.Button1) Me.TabPage1.Controls.Add(Me.tx_mailfrom) Me.TabPage1.Controls.Add(Me.tx_pass) Me.TabPage1.Controls.Add(Me.tx_user) Me.TabPage1.Controls.Add(Me.tx_smtp) Me.TabPage1.Controls.Add(Me.tx_pop) Me.TabPage1.Controls.Add(Me.Label5) Me.TabPage1.Controls.Add(Me.Label4) Me.TabPage1.Controls.Add(Me.Label3) Me.TabPage1.Controls.Add(Me.Label2) Me.TabPage1.Controls.Add(Me.Label1) Me.TabPage1.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.TabPage1.Location = New System.Drawing.Point(4, 21) Me.TabPage1.Name = "TabPage1" Me.TabPage1.Size = New System.Drawing.Size(464, 367) Me.TabPage1.TabIndex = 0 Me.TabPage1.Text = "MailConfig" ' 'Status ' Me.Status.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Status.ItemHeight = 12 Me.Status.Location = New System.Drawing.Point(16, 240) Me.Status.Name = "Status" Me.Status.Size = New System.Drawing.Size(416, 112) Me.Status.TabIndex = 12 ' 'Button2 ' Me.Button2.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Button2.Location = New System.Drawing.Point(232, 200) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(96, 23) Me.Button2.TabIndex = 11 Me.Button2.Text = "SaveInfo" ' 'Button1 ' Me.Button1.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Button1.Location = New System.Drawing.Point(96, 200) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(96, 23) Me.Button1.TabIndex = 10 Me.Button1.Text = "TestConnect" ' 'tx_mailfrom ' Me.tx_mailfrom.Location = New System.Drawing.Point(136, 152) Me.tx_mailfrom.Name = "tx_mailfrom" Me.tx_mailfrom.Size = New System.Drawing.Size(296, 21) Me.tx_mailfrom.TabIndex = 9 Me.tx_mailfrom.Text = "" ' 'tx_pass ' Me.tx_pass.Location = New System.Drawing.Point(136, 120) Me.tx_pass.Name = "tx_pass" Me.tx_pass.Size = New System.Drawing.Size(296, 21) Me.tx_pass.TabIndex = 8 Me.tx_pass.Text = "" ' 'tx_user ' Me.tx_user.Location = New System.Drawing.Point(136, 88) Me.tx_user.Name = "tx_user" Me.tx_user.Size = New System.Drawing.Size(296, 21) Me.tx_user.TabIndex = 7 Me.tx_user.Text = "" ' 'tx_smtp ' Me.tx_smtp.Location = New System.Drawing.Point(136, 56) Me.tx_smtp.Name = "tx_smtp" Me.tx_smtp.Size = New System.Drawing.Size(296, 21) Me.tx_smtp.TabIndex = 6 Me.tx_smtp.Text = "" ' 'tx_pop ' Me.tx_pop.Location = New System.Drawing.Point(136, 24) Me.tx_pop.Name = "tx_pop" Me.tx_pop.Size = New System.Drawing.Size(296, 21) Me.tx_pop.TabIndex = 5 Me.tx_pop.Text = "" ' 'Label5 ' Me.Label5.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label5.Location = New System.Drawing.Point(16, 152) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(112, 23) Me.Label5.TabIndex = 4 Me.Label5.Text = "Mail_From" Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'Label4 ' Me.Label4.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label4.Location = New System.Drawing.Point(16, 120) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(112, 23) Me.Label4.TabIndex = 3 Me.Label4.Text = "PASSWORD" Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'Label3 ' Me.Label3.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label3.Location = New System.Drawing.Point(16, 88) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(112, 23) Me.Label3.TabIndex = 2 Me.Label3.Text = "USERNAME" Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'Label2 ' Me.Label2.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label2.Location = New System.Drawing.Point(16, 56) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(112, 23) Me.Label2.TabIndex = 1 Me.Label2.Text = "SMTP_MailServer" Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'Label1 ' Me.Label1.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label1.Location = New System.Drawing.Point(16, 24) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(112, 23) Me.Label1.TabIndex = 0 Me.Label1.Text = "POP_MailServer" Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'TabPage2 ' Me.TabPage2.Controls.Add(Me.GroupBox2) Me.TabPage2.Controls.Add(Me.GroupBox1) Me.TabPage2.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.TabPage2.Location = New System.Drawing.Point(4, 21) Me.TabPage2.Name = "TabPage2" Me.TabPage2.Size = New System.Drawing.Size(464, 367) Me.TabPage2.TabIndex = 1 Me.TabPage2.Text = "ComPortConfig" ' 'GroupBox2 ' Me.GroupBox2.Controls.Add(Me.AxMSComm1) Me.GroupBox2.Controls.Add(Me.Button4) Me.GroupBox2.Controls.Add(Me.textBox1) Me.GroupBox2.Controls.Add(Me.Label19) Me.GroupBox2.Controls.Add(Me.comboBox1) Me.GroupBox2.Controls.Add(Me.comboBox2) Me.GroupBox2.Controls.Add(Me.textBox5) Me.GroupBox2.Controls.Add(Me.textBox4) Me.GroupBox2.Controls.Add(Me.textBox3) Me.GroupBox2.Controls.Add(Me.Label12) Me.GroupBox2.Controls.Add(Me.Label13) Me.GroupBox2.Controls.Add(Me.Label14) Me.GroupBox2.Controls.Add(Me.Label15) Me.GroupBox2.Controls.Add(Me.Label16) Me.GroupBox2.Controls.Add(Me.textBox2) Me.GroupBox2.Controls.Add(Me.Label17) Me.GroupBox2.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.GroupBox2.Location = New System.Drawing.Point(240, 15) Me.GroupBox2.Name = "GroupBox2" Me.GroupBox2.Size = New System.Drawing.Size(208, 336) Me.GroupBox2.TabIndex = 1 Me.GroupBox2.TabStop = False Me.GroupBox2.Text = "GPRS_config" ' 'AxMSComm1 ' Me.AxMSComm1.ContainingControl = Me Me.AxMSComm1.Enabled = True Me.AxMSComm1.Location = New System.Drawing.Point(48, 280) Me.AxMSComm1.Name = "AxMSComm1" Me.AxMSComm1.OcxState = CType(resources.GetObject("AxMSComm1.OcxState"), System.Windows.Forms.AxHost.State) Me.AxMSComm1.Size = New System.Drawing.Size(38, 38) Me.AxMSComm1.TabIndex = 27 ' 'Button4 ' Me.Button4.Location = New System.Drawing.Point(112, 280) Me.Button4.Name = "Button4" Me.Button4.TabIndex = 26 Me.Button4.Text = "SaveInfo" ' 'textBox1 ' Me.textBox1.Location = New System.Drawing.Point(88, 216) Me.textBox1.Name = "textBox1" Me.textBox1.TabIndex = 25 Me.textBox1.Text = "" ' 'Label19 ' Me.Label19.Location = New System.Drawing.Point(8, 216) Me.Label19.Name = "Label19" Me.Label19.Size = New System.Drawing.Size(72, 23) Me.Label19.TabIndex = 24 Me.Label19.Text = "ReadLen" ' 'comboBox1 ' Me.comboBox1.Items.AddRange(New Object() {"comInputModeText", "comInputModeBinary"}) Me.comboBox1.Location = New System.Drawing.Point(88, 184) Me.comboBox1.Name = "comboBox1" Me.comboBox1.Size = New System.Drawing.Size(112, 20) Me.comboBox1.TabIndex = 23 ' 'comboBox2 ' Me.comboBox2.Items.AddRange(New Object() {"comNone", "comXonXoff", "comRTS", "comRTSXOnXOff"}) Me.comboBox2.Location = New System.Drawing.Point(88, 152) Me.comboBox2.Name = "comboBox2" Me.comboBox2.Size = New System.Drawing.Size(112, 20) Me.comboBox2.TabIndex = 22 ' 'textBox5 ' Me.textBox5.Location = New System.Drawing.Point(90, 120) Me.textBox5.Name = "textBox5" Me.textBox5.TabIndex = 21 Me.textBox5.Text = "" ' 'textBox4 ' Me.textBox4.Location = New System.Drawing.Point(90, 88) Me.textBox4.Name = "textBox4" Me.textBox4.TabIndex = 20 Me.textBox4.Text = "" ' 'textBox3 ' Me.textBox3.Location = New System.Drawing.Point(90, 56) Me.textBox3.Name = "textBox3" Me.textBox3.TabIndex = 19 Me.textBox3.Text = "" ' 'Label12 ' Me.Label12.Location = New System.Drawing.Point(10, 184) Me.Label12.Name = "Label12" Me.Label12.Size = New System.Drawing.Size(72, 23) Me.Label12.TabIndex = 18 Me.Label12.Text = "ReadMode" ' 'Label13 ' Me.Label13.Location = New System.Drawing.Point(10, 152) Me.Label13.Name = "Label13" Me.Label13.Size = New System.Drawing.Size(72, 23) Me.Label13.TabIndex = 17 Me.Label13.Text = "Protocols" ' 'Label14 ' Me.Label14.Location = New System.Drawing.Point(10, 120) Me.Label14.Name = "Label14" Me.Label14.Size = New System.Drawing.Size(72, 23) Me.Label14.TabIndex = 16 Me.Label14.Text = "stopbyte" ' 'Label15 ' Me.Label15.Location = New System.Drawing.Point(10, 88) Me.Label15.Name = "Label15" Me.Label15.Size = New System.Drawing.Size(72, 23) Me.Label15.TabIndex = 15 Me.Label15.Text = "bytesize" ' 'Label16 ' Me.Label16.Location = New System.Drawing.Point(10, 56) Me.Label16.Name = "Label16" Me.Label16.Size = New System.Drawing.Size(72, 23) Me.Label16.TabIndex = 14 Me.Label16.Text = "Rate" ' 'textBox2 ' Me.textBox2.Location = New System.Drawing.Point(90, 24) Me.textBox2.Name = "textBox2" Me.textBox2.TabIndex = 13 Me.textBox2.Text = "" ' 'Label17 ' Me.Label17.Location = New System.Drawing.Point(10, 24) Me.Label17.Name = "Label17" Me.Label17.Size = New System.Drawing.Size(72, 23) Me.Label17.TabIndex = 12 Me.Label17.Text = "ComPort" ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.com) Me.GroupBox1.Controls.Add(Me.Button3) Me.GroupBox1.Controls.Add(Me.txReadLen) Me.GroupBox1.Controls.Add(Me.Label18) Me.GroupBox1.Controls.Add(Me.cbReadM) Me.GroupBox1.Controls.Add(Me.cbPro) Me.GroupBox1.Controls.Add(Me.t_stopbyte) Me.GroupBox1.Controls.Add(Me.t_bytesize) Me.GroupBox1.Controls.Add(Me.t_rate) Me.GroupBox1.Controls.Add(Me.Label11) Me.GroupBox1.Controls.Add(Me.Label10) Me.GroupBox1.Controls.Add(Me.Label9) Me.GroupBox1.Controls.Add(Me.Label8) Me.GroupBox1.Controls.Add(Me.Label7) Me.GroupBox1.Controls.Add(Me.t_port) Me.GroupBox1.Controls.Add(Me.Label6) Me.GroupBox1.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.GroupBox1.Location = New System.Drawing.Point(8, 16) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(208, 336) Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False Me.GroupBox1.Text = "Temp_config" ' 'com ' Me.com.ContainingControl = Me Me.com.Enabled = True Me.com.Location = New System.Drawing.Point(32, 272) Me.com.Name = "com" Me.com.OcxState = CType(resources.GetObject("com.OcxState"), System.Windows.Forms.AxHost.State) Me.com.Size = New System.Drawing.Size(38, 38) Me.com.TabIndex = 15 ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(104, 280) Me.Button3.Name = "Button3" Me.Button3.TabIndex = 14 Me.Button3.Text = "SaveInfo" ' 'txReadLen ' Me.txReadLen.Location = New System.Drawing.Point(88, 216) Me.txReadLen.Name = "txReadLen" Me.txReadLen.TabIndex = 13 Me.txReadLen.Text = "" ' 'Label18 ' Me.Label18.Location = New System.Drawing.Point(8, 216) Me.Label18.Name = "Label18" Me.Label18.Size = New System.Drawing.Size(72, 23) Me.Label18.TabIndex = 12 Me.Label18.Text = "ReadLen" ' 'cbReadM ' Me.cbReadM.Items.AddRange(New Object() {"comInputModeText", "comInputModeBinary"}) Me.cbReadM.Location = New System.Drawing.Point(88, 184) Me.cbReadM.Name = "cbReadM" Me.cbReadM.Size = New System.Drawing.Size(112, 20) Me.cbReadM.TabIndex = 11 ' 'cbPro ' Me.cbPro.Items.AddRange(New Object() {"comNone", "comXonXoff", "comRTS", "comRTSXOnXOff"}) Me.cbPro.Location = New System.Drawing.Point(88, 152) Me.cbPro.Name = "cbPro" Me.cbPro.Size = New System.Drawing.Size(112, 20) Me.cbPro.TabIndex = 10 ' 't_stopbyte ' Me.t_stopbyte.Location = New System.Drawing.Point(88, 120) Me.t_stopbyte.Name = "t_stopbyte" Me.t_stopbyte.TabIndex = 9 Me.t_stopbyte.Text = "" ' 't_bytesize ' Me.t_bytesize.Location = New System.Drawing.Point(88, 88) Me.t_bytesize.Name = "t_bytesize" Me.t_bytesize.TabIndex = 8 Me.t_bytesize.Text = "" ' 't_rate ' Me.t_rate.Location = New System.Drawing.Point(88, 56) Me.t_rate.Name = "t_rate" Me.t_rate.TabIndex = 7 Me.t_rate.Text = "" ' 'Label11 ' Me.Label11.Location = New System.Drawing.Point(8, 184) Me.Label11.Name = "Label11" Me.Label11.Size = New System.Drawing.Size(72, 23) Me.Label11.TabIndex = 6 Me.Label11.Text = "ReadMode" ' 'Label10 ' Me.Label10.Location = New System.Drawing.Point(8, 152) Me.Label10.Name = "Label10" Me.Label10.Size = New System.Drawing.Size(72, 23) Me.Label10.TabIndex = 5 Me.Label10.Text = "Protocols" ' 'Label9 ' Me.Label9.Location = New System.Drawing.Point(8, 120) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(72, 23) Me.Label9.TabIndex = 4 Me.Label9.Text = "stopbyte" ' 'Label8 ' Me.Label8.Location = New System.Drawing.Point(8, 88) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(72, 23) Me.Label8.TabIndex = 3 Me.Label8.Text = "bytesize" ' 'Label7 ' Me.Label7.Location = New System.Drawing.Point(8, 56) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(72, 23) Me.Label7.TabIndex = 2 Me.Label7.Text = "Rate" ' 't_port ' Me.t_port.Location = New System.Drawing.Point(88, 24) Me.t_port.Name = "t_port" Me.t_port.TabIndex = 1 Me.t_port.Text = "" ' 'Label6 ' Me.Label6.Location = New System.Drawing.Point(8, 24) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(72, 23) Me.Label6.TabIndex = 0 Me.Label6.Text = "ComPort" ' 'TabPage3 ' Me.TabPage3.Controls.Add(Me.Button6) Me.TabPage3.Controls.Add(Me.Button5) Me.TabPage3.Controls.Add(Me.Label25) Me.TabPage3.Controls.Add(Me.tx_limit) Me.TabPage3.Controls.Add(Me.Label24) Me.TabPage3.Controls.Add(Me.Label23) Me.TabPage3.Controls.Add(Me.tx_time) Me.TabPage3.Controls.Add(Me.Label22) Me.TabPage3.Controls.Add(Me.tx_phone3) Me.TabPage3.Controls.Add(Me.tx_phone2) Me.TabPage3.Controls.Add(Me.tx_phone1) Me.TabPage3.Controls.Add(Me.Label21) Me.TabPage3.Controls.Add(Me.tx_mail3) Me.TabPage3.Controls.Add(Me.tx_mail2) Me.TabPage3.Controls.Add(Me.tx_mail1) Me.TabPage3.Controls.Add(Me.Label20) Me.TabPage3.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.TabPage3.Location = New System.Drawing.Point(4, 21) Me.TabPage3.Name = "TabPage3" Me.TabPage3.Size = New System.Drawing.Size(464, 367) Me.TabPage3.TabIndex = 2 Me.TabPage3.Text = "SysConfig" ' 'Button6 ' Me.Button6.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Button6.Location = New System.Drawing.Point(256, 296) Me.Button6.Name = "Button6" Me.Button6.Size = New System.Drawing.Size(88, 23) Me.Button6.TabIndex = 15 Me.Button6.Text = "StartService" ' 'Button5 ' Me.Button5.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Button5.Location = New System.Drawing.Point(104, 296) Me.Button5.Name = "Button5" Me.Button5.Size = New System.Drawing.Size(88, 23) Me.Button5.TabIndex = 14 Me.Button5.Text = "SaveInfo" ' 'Label25 ' Me.Label25.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label25.Location = New System.Drawing.Point(336, 240) Me.Label25.Name = "Label25" Me.Label25.TabIndex = 13 Me.Label25.Text = " C" Me.Label25.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'tx_limit ' Me.tx_limit.Location = New System.Drawing.Point(176, 240) Me.tx_limit.Name = "tx_limit" Me.tx_limit.Size = New System.Drawing.Size(152, 21) Me.tx_limit.TabIndex = 12 Me.tx_limit.Text = "" ' 'Label24 ' Me.Label24.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label24.Location = New System.Drawing.Point(8, 240) Me.Label24.Name = "Label24" Me.Label24.Size = New System.Drawing.Size(160, 23) Me.Label24.TabIndex = 11 Me.Label24.Text = "Set Temp limit" ' 'Label23 ' Me.Label23.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label23.Location = New System.Drawing.Point(336, 208) Me.Label23.Name = "Label23" Me.Label23.TabIndex = 10 Me.Label23.Text = "(min)" Me.Label23.TextAlign = System.Drawing.ContentAlignment.MiddleLeft ' 'tx_time ' Me.tx_time.Location = New System.Drawing.Point(176, 208) Me.tx_time.Name = "tx_time" Me.tx_time.Size = New System.Drawing.Size(152, 21) Me.tx_time.TabIndex = 9 Me.tx_time.Text = "" ' 'Label22 ' Me.Label22.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label22.Location = New System.Drawing.Point(8, 208) Me.Label22.Name = "Label22" Me.Label22.Size = New System.Drawing.Size(160, 23) Me.Label22.TabIndex = 8 Me.Label22.Text = "Set Time Tick" ' 'tx_phone3 ' Me.tx_phone3.Location = New System.Drawing.Point(176, 176) Me.tx_phone3.Name = "tx_phone3" Me.tx_phone3.Size = New System.Drawing.Size(272, 21) Me.tx_phone3.TabIndex = 7 Me.tx_phone3.Text = "" ' 'tx_phone2 ' Me.tx_phone2.Location = New System.Drawing.Point(176, 144) Me.tx_phone2.Name = "tx_phone2" Me.tx_phone2.Size = New System.Drawing.Size(272, 21) Me.tx_phone2.TabIndex = 6 Me.tx_phone2.Text = "" ' 'tx_phone1 ' Me.tx_phone1.Location = New System.Drawing.Point(176, 112) Me.tx_phone1.Name = "tx_phone1" Me.tx_phone1.Size = New System.Drawing.Size(272, 21) Me.tx_phone1.TabIndex = 5 Me.tx_phone1.Text = "" ' 'Label21 ' Me.Label21.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label21.Location = New System.Drawing.Point(8, 112) Me.Label21.Name = "Label21" Me.Label21.Size = New System.Drawing.Size(160, 23) Me.Label21.TabIndex = 4 Me.Label21.Text = "Set Receive Phone No" ' 'tx_mail3 ' Me.tx_mail3.Location = New System.Drawing.Point(176, 80) Me.tx_mail3.Name = "tx_mail3" Me.tx_mail3.Size = New System.Drawing.Size(272, 21) Me.tx_mail3.TabIndex = 3 Me.tx_mail3.Text = "" ' 'tx_mail2 ' Me.tx_mail2.Location = New System.Drawing.Point(176, 48) Me.tx_mail2.Name = "tx_mail2" Me.tx_mail2.Size = New System.Drawing.Size(272, 21) Me.tx_mail2.TabIndex = 2 Me.tx_mail2.Text = "" ' 'tx_mail1 ' Me.tx_mail1.Location = New System.Drawing.Point(176, 16) Me.tx_mail1.Name = "tx_mail1" Me.tx_mail1.Size = New System.Drawing.Size(272, 21) Me.tx_mail1.TabIndex = 1 Me.tx_mail1.Text = "" ' 'Label20 ' Me.Label20.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Label20.Location = New System.Drawing.Point(8, 16) Me.Label20.Name = "Label20" Me.Label20.Size = New System.Drawing.Size(160, 23) Me.Label20.TabIndex = 0 Me.Label20.Text = "Set Receive Mail Account" ' 'TabPage4 ' Me.TabPage4.Controls.Add(Me.Button8) Me.TabPage4.Controls.Add(Me.Button7) Me.TabPage4.Controls.Add(Me.DataGrid1) Me.TabPage4.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.TabPage4.Location = New System.Drawing.Point(4, 21) Me.TabPage4.Name = "TabPage4" Me.TabPage4.Size = New System.Drawing.Size(464, 367) Me.TabPage4.TabIndex = 3 Me.TabPage4.Text = "SysLog" ' 'Button8 ' Me.Button8.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Button8.Location = New System.Drawing.Point(256, 320) Me.Button8.Name = "Button8" Me.Button8.TabIndex = 2 Me.Button8.Text = "delete" ' 'Button7 ' Me.Button7.ForeColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(64, Byte), CType(0, Byte)) Me.Button7.Location = New System.Drawing.Point(96, 320) Me.Button7.Name = "Button7" Me.Button7.TabIndex = 1 Me.Button7.Text = "Search" ' 'DataGrid1 ' Me.DataGrid1.DataMember = "" Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.DataGrid1.Location = New System.Drawing.Point(8, 8) Me.DataGrid1.Name = "DataGrid1" Me.DataGrid1.Size = New System.Drawing.Size(448, 288) Me.DataGrid1.TabIndex = 0 ' 'Timer1 ' Me.Timer1.Interval = 180000 ' 'Dataset11 ' Me.Dataset11.DataSetName = "Dataset1" Me.Dataset11.Locale = New System.Globalization.CultureInfo("en-US") ' 'Form1 ' Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14) Me.ClientSize = New System.Drawing.Size(568, 454) Me.Controls.Add(Me.TabControl1) Me.Name = "Form1" Me.Text = "TempServer" Me.TabControl1.ResumeLayout(False) Me.TabPage1.ResumeLayout(False) Me.TabPage2.ResumeLayout(False) Me.GroupBox2.ResumeLayout(False) CType(Me.AxMSComm1, System.ComponentModel.ISupportInitialize).EndInit() Me.GroupBox1.ResumeLayout(False) CType(Me.com, System.ComponentModel.ISupportInitialize).EndInit() Me.TabPage3.ResumeLayout(False) Me.TabPage4.ResumeLayout(False) CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Dataset11, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim POPClient As New TcpClient(tx_pop.Text, 110) Status.Items.Clear() If tx_pop.Text.Trim = "" Or tx_smtp.Text.Trim = "" Then MessageBox.Show("Please input POP or SMTP SERVER ADDRESS") Exit Sub End If If tx_user.Text.Trim = "" Or tx_pass.Text.Trim = "" Then MessageBox.Show("Please input Your UserName or PASSWORD TO Login MailServer") Exit Sub End If Try NetStream = POPClient.GetStream() RdStrm = New StreamReader(POPClient.GetStream()) Status.Items.Add(RdStrm.ReadLine())
Data = "USER " + tx_user.Text + Chr(13) + Chr(10) SData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray()) NetStream.Write(SData, 0, SData.Length) Status.Items.Add(RdStrm.ReadLine())
Data = "PASS " + tx_pass.Text + Chr(13) + Chr(10) SData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray()) NetStream.Write(SData, 0, SData.Length) Status.Items.Add(RdStrm.ReadLine())
Data = "STAT" + Chr(13) + Chr(10) SData = System.Text.Encoding.ASCII.GetBytes(Data.ToCharArray()) NetStream.Write(SData, 0, SData.Length) Status.Items.Add(RdStrm.ReadLine()) Catch ex As Exception Status.Items.Add("Error: " + ex.ToString()) End Try End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try '新建表 dtOrderList = New DataTable With dtOrderList.Columns .Add("id", Type.GetType("System.String")) .Add("time", Type.GetType("System.String")) .Add("temperature", Type.GetType("System.String")) .Add("date", Type.GetType("System.String")) End With Dim ts As New DataGridTableStyle Dim aColumnTextColumn As DataGridTextBoxColumn Dim numCols As Integer = dtOrderList.Columns.Count Dim i As Integer For i = 0 To numCols - 1 aColumnTextColumn = New DataGridTextBoxColumn With aColumnTextColumn .MappingName = dtOrderList.Columns(i).ColumnName .HeaderText = dtOrderList.Columns(i).ColumnName .NullText = "" End With ts.GridColumnStyles.Add(aColumnTextColumn) Next ts.MappingName = dtOrderList.TableName ts.ReadOnly = True '设置设置DataGrid中奇数行的背景色 ts.AlternatingBackColor = Color.Linen ts.AllowSorting = False DataGrid1.TableStyles.Add(ts)
DataGrid1.DataSource = dtOrderList.DefaultView dtOrderList.DefaultView.AllowNew = False Dim db As DataBase = New DataBase Dim dv As DataView = db.RunSelectSQL("select * from Htemp") If dv.Count <> 0 Then tx_pop.Text = dv.Table.Rows(0)("popserver").ToString tx_smtp.Text = dv.Table.Rows(0)("smtpserver").ToString tx_user.Text = dv.Table.Rows(0)("username").ToString tx_pass.Text = dv.Table.Rows(0)("password").ToString t_port.Text = dv.Table.Rows(0)("t_port").ToString t_rate.Text = dv.Table.Rows(0)("t_rate").ToString t_bytesize.Text = dv.Table.Rows(0)("t_bytesize").ToString t_stopbyte.Text = dv.Table.Rows(0)("t_stopbyte").ToString cbPro.SelectedItem = dv.Table.Rows(0)("t_pro").ToString cbReadM.SelectedItem = dv.Table.Rows(0)("t_readm").ToString txReadLen.Text = dv.Table.Rows(0)("t_readlen").ToString textBox2.Text = dv.Table.Rows(0)("g_port").ToString textBox3.Text = dv.Table.Rows(0)("g_rate").ToString textBox4.Text = dv.Table.Rows(0)("g_bytesize").ToString textBox5.Text = dv.Table.Rows(0)("g_stopbyte").ToString comboBox2.SelectedItem = dv.Table.Rows(0)("g_pro").ToString comboBox1.SelectedItem = dv.Table.Rows(0)("g_readm").ToString textBox1.Text = dv.Table.Rows(0)("g_readlen").ToString tx_mail1.Text = dv.Table.Rows(0)("mail1").ToString tx_mail2.Text = dv.Table.Rows(0)("mail2").ToString tx_mail3.Text = dv.Table.Rows(0)("mail3").ToString tx_phone1.Text = dv.Table.Rows(0)("tel1").ToString tx_phone2.Text = dv.Table.Rows(0)("tel2").ToString tx_phone3.Text = dv.Table.Rows(0)("tel3").ToString tx_time.Text = dv.Table.Rows(0)("time").ToString tx_limit.Text = dv.Table.Rows(0)("limit").ToString tx_mailfrom.Text = dv.Table.Rows(0)("mailfrom").ToString Else MessageBox.Show("Please Check DB Connect") End If db.Dispose() Catch ex As Exception
End Try End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim db As DataBase = New DataBase Dim dv As DataView = db.RunDelOrInsSQL("update H_mailconfig set popserver='" + tx_pop.Text.Trim() + "',smtpserver='" + tx_smtp.Text.Trim() + "',username='" + tx_user.Text.Trim() + "',password='" + tx_pass.Text.Trim() + "',mailfrom='" + tx_mailfrom.Text.Trim() + "'") MessageBox.Show("Save Successful!") db.Dispose() End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim db As DataBase = New DataBase Dim dv As DataView = db.RunDelOrInsSQL("update T_config set t_port='" + t_port.Text.Trim() + "',t_rate='" + t_rate.Text.Trim() + "',t_bytesize='" + t_bytesize.Text.Trim() + "',t_stopbyte='" + t_stopbyte.Text.Trim() + "',t_pro='" + cbPro.SelectedItem.ToString().Trim() + "',t_readm='" + cbReadM.SelectedItem.ToString().Trim() + "',t_readlen='" + txReadLen.Text.Trim() + "'") MessageBox.Show("Save Successful!") db.Dispose() End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Dim db As DataBase = New DataBase Dim dv As DataView = db.RunDelOrInsSQL("update G_config set g_port='" + textBox2.Text.Trim() + "',g_rate='" + textBox3.Text.Trim() + "',g_bytesize='" + textBox4.Text.Trim() + "',g_stopbyte='" + textBox5.Text.Trim() + "',g_pro='" + comboBox2.SelectedItem.ToString().Trim() + "',g_readm='" + comboBox1.SelectedItem.ToString().Trim() + "',g_readlen='" + textBox1.Text.Trim() + "'") MessageBox.Show("Save Successful!") db.Dispose() End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Dim db As DataBase = New DataBase Dim dv As DataView = db.RunDelOrInsSQL("update S_config set mail1='" + tx_mail1.Text.Trim() + "',mail2='" + tx_mail2.Text.Trim() + "',mail3='" + tx_mail3.Text.Trim() + "',tel1='" + tx_phone1.Text.Trim() + "',tel2='" + tx_phone2.Text.Trim() + "',tel3='" + tx_phone3.Text.Trim() + "',time='" + tx_time.Text.Trim() + "',limit='" + tx_limit.Text.Trim() + "'") MessageBox.Show("Save Successful!") db.Dispose() End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click Try com.CommPort = Convert.ToInt16(t_port.Text.Trim()) If com.PortOpen Then com.PortOpen = False End If com.RThreshold = Convert.ToInt16(txReadLen.Text.Trim()) com.SThreshold = 0 com.Settings = "" + t_rate.Text.Trim() + ",n," + t_bytesize.Text.Trim() + "," + t_stopbyte.Text.Trim() + ""
Select Case cbPro.SelectedItem.ToString().Trim() Case "comNone" com.Handshaking = MSCommLib.HandshakeConstants.comNone Case "comXonXoff" com.Handshaking = MSCommLib.HandshakeConstants.comXOnXoff Case "comRTS" com.Handshaking = MSCommLib.HandshakeConstants.comRTS Case "comRTSXOnXOff" com.Handshaking = MSCommLib.HandshakeConstants.comRTSXOnXOff Case Else MessageBox.Show("Pro Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning) End Select
Select Case cbReadM.SelectedItem.ToString.Trim Case "comInputModeText" com.InputMode = MSCommLib.InputModeConstants.comInputModeText Case "comInputModeBinary" com.InputMode = MSCommLib.InputModeConstants.comInputModeBinary Case Else MessageBox.Show("Read Type Error!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning) End Select com.InputLen = 0
com.PortOpen = True
Dim ComPORT As Integer ComPORT = Me.textBox2.Text AxMSComm1.CommPort = ComPORT
AxMSComm1.Settings = "115200,N,8,1"
AxMSComm1.InputLen = 0
AxMSComm1.PortOpen = True Catch ex As Exception
End Try End Sub
Private Sub com_OnComm(ByVal sender As Object, ByVal e As System.EventArgs) Handles com.OnComm Try Dim bytIn As Byte() Dim objIn As Object Dim i As Integer objIn = com.Input bytIn = CType(objIn, Byte()) i = 0 i = 0 While i <= (bytIn.Length - 1) strIn += bytIn(i).ToString End While
If Convert.ToInt32(strIn) > Convert.ToInt32(Me.tx_limit.Text.Trim) And Bool = True Then 'Dim mailObj As MailMessage = New MailMessage 'mailObj.To = "'" + Me.tx_mail1.Text + ",'" + Me.tx_mail3.Text + "','" + Me.tx_mail2.Text + "'" 'mailObj.From = tx_mailfrom.Text 'mailObj.Subject = "The temperature is excessive" 'mailObj.Body = "Warning:Now the temperature is" + strIn + "C,Please Check it" 'mailObj.BodyFormat = MailFormat.Html 'mailObj.Priority = MailPriority.High 'SmtpMail.Send(mailObj) Dim phonemsg As String = "The temperature is excessive,Now the temperature is" + strIn + "C" sendmsg(tx_phone1.Text.Trim, phonemsg) sendmsg(tx_phone2.Text.Trim, phonemsg) sendmsg(tx_phone3.Text.Trim, phonemsg) Bool = False Me.Timer1.Enabled = True End If Catch MessageBox.Show("ERROR +++!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning) End Try End Sub Private Sub sendmsg(ByVal phoneno As String, ByVal msg As String) Dim Instring As String Dim Buffer$
Out_STR = ""
AxMSComm1.Output = "atz" & Chr(13) Call COMM1()
Application.DoEvents() AxMSComm1.Output = "at+cpms=MT" & Chr(13) Call COMM1()
Application.DoEvents() AxMSComm1.Output = "at+cscs=ASCII" & Chr(13) Call COMM1()
Application.DoEvents() AxMSComm1.Output = "at+cmgw=" + Chr(34) + phoneno + Chr(34) & Chr(13)
Application.DoEvents() AxMSComm1.Output = msg & Chr(26) Call COMM1()
Application.DoEvents() If Out_STR <> "" Then AxMSComm1.Output = "at+cmss=" & Out_STR & Chr(13) Call COMM1() Application.DoEvents() AxMSComm1.Output = "at+cmgd=" & Out_STR & Chr(13) Call COMM1() Else MsgBox("Sorry,Fail", vbOKOnly + vbCritical, "ERROR") End If
AxMSComm1.PortOpen = False End Sub
Sub COMM1() Dim Ctn As Integer Dim Buffer$ Ctn = 0 Do Application.DoEvents() Buffer$ = Buffer$ & AxMSComm1.Input Loop Until (InStr(Buffer$, "OK" & vbCrLf)) Or (InStr(Buffer$, "ERROR" & vbCrLf)) If InStr(Buffer$, "+CMGW:") Then Ctn = InStr(Buffer$, "+CMGW:") Out_STR = Trim(Mid(Buffer$, Ctn + 6, 4)) End If End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Bool = True End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click Dataset11.Tables("SystemLog").Clear()
End SubEnd Class---------------------------------------------------------------------------------------------------------------------------
