| | |
Countdown Timer
![]() |
•
•
Join Date: Jul 2008
Posts: 8
Reputation:
Solved Threads: 0
Sorry for the long delay. I'll explain about the project I'm doing. I'm trying to create a SMS based reminder application using visual basic and a GSM modem. Currently, the program has the ability to send, extract, receive and store. Now I would like to enable the program to send a reminder using the time stored in the database. For example, if the user sends 10# tower, this would be saved in the database as 10 under the hour column, User's Handphone number would be under Numbers and tower under Message. Once 10 hours are up, the program would send an SMS back to the user.
Below is the code for the program
Below is the code for the program
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Public Class Form1 Dim TotalRows As Integer Dim NextRecord As Integer Dim ConObject As New OleDb.OleDbConnection Dim dSet As New DataSet Dim dAdapter As OleDb.OleDbDataAdapter Dim Sel As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ConObject.ConnectionString = "PROVIDER=MICROSOFT.Jet.OLEDB.4.0;Data Source= C:\Documents and Settings\Telematics\My Documents\061514U Edmund\lab_3\ProjectDB.mdb" ConObject.Open() Sel = "SELECT*FROM Table1" dAdapter = New OleDb.OleDbDataAdapter(Sel, ConObject) dAdapter.Fill(dSet, "ProjectDB") ConObject.Close() TotalRows = dSet.Tables("ProjectDB").Rows.Count End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Call ModemMode() End Sub Private Sub ModemMode() If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() SerialPort1.WriteLine("AT+CMGF=1" + vbCr) WaitForm.ShowDialog() TextBox1.Text = "" TextBox1.Text = SerialPort1.ReadExisting If InStr(TextBox1.Text, "OK") <> 0 Then MessageBox.Show("Successful(CMGF)!") Else MessageBox.Show("Try again") End If TextBox1.Text = "" SerialPort1.WriteLine("AT+CNMI=0,1,0,0,0" + vbCr) WaitForm.ShowDialog() WaitForm.ShowDialog() TextBox1.Text = SerialPort1.ReadExisting If InStr(TextBox1.Text, "OK") <> 0 Then MessageBox.Show("Successful(CNMI)!") Else MessageBox.Show("Try again") End If SerialPort1.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Call ReadSMS() End Sub Private Sub ReadSMS() If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() SerialPort1.WriteLine("AT+CMGR=" + TextBox2.Text + vbCr) System.Threading.Thread.Sleep(500) TextBox1.Text = "" TextBox1.Text = SerialPort1.ReadExisting SerialPort1.Close() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() SerialPort1.WriteLine("AT+CMGD=1,4" + vbCr) TextBox1.Text = vbNewLine & "...in progress..." TextBox1.Refresh() System.Threading.Thread.Sleep(4000) System.Threading.Thread.Sleep(4000) System.Threading.Thread.Sleep(4000) TextBox1.Text = "" TextBox1.Text = SerialPort1.ReadExisting SerialPort1.Close() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click Call DeleteOneSMS() End Sub Private Sub DeleteOneSMS() If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() SerialPort1.WriteLine("AT+CMGD=" + TextBox6.Text + vbCr) TextBox1.Text = vbNewLine & "...in progress..." TextBox1.Refresh() System.Threading.Thread.Sleep(1250) TextBox1.Text = "" TextBox1.Text = SerialPort1.ReadExisting SerialPort1.Close() End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click Call SendSMS() End Sub Private Sub SendSMS() If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() SerialPort1.WriteLine("AT+CMGS=" + TextBox3.Text + vbCr) TextBox1.Text = vbNewLine & "...SMS sending in progress..." TextBox1.Refresh() System.Threading.Thread.Sleep(750) SerialPort1.WriteLine(TextBox4.Text) System.Threading.Thread.Sleep(500) SerialPort1.WriteLine(Chr(26)) System.Threading.Thread.Sleep(5500) TextBox1.Text = "" TextBox1.Text = SerialPort1.ReadExisting If InStr(TextBox1.Text, "OK") <> 0 Then TextBox1.Text = "SMS message successfully sent!" MessageBox.Show("SMS message successfully sent!") Else MessageBox.Show("Try again") End If SerialPort1.Close() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick TextBox5.Text = TextBox4.Text.Length If TextBox5.Text > 160 Then Beep() End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick End Sub Private Sub ExtractPhoneNumber() If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() Dim str1 Dim str2 Dim Extract As String str1 = TextBox1.Text str2 = str1.Split("D") TextBox7.Text = str2(1) Extract = TextBox7.Text.Substring(3, 11) TextBox7.Text = Extract End Sub Private Sub ExtractMessage() If SerialPort1.IsOpen Then SerialPort1.Close() End If SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 115200 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.DataBits = 8 SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.RtsEnable = True SerialPort1.Open() Dim str3 Dim str4 Dim Extract2 As String Dim Extract3 As String str3 = TextBox1.Text str4 = str3.Split("#") TextBox8.Text = str4(1) Extract2 = TextBox8.Text.Substring(2) Extract3 = TextBox8.Text.Substring(0, 2) TextBox8.Text = Extract2 TextBox9.Text = Extract3 End Sub Private Sub button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button6.Click Call ExtractMessage() Call ExtractPhoneNumber() End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" TextBox6.Text = "" TextBox7.Text = "" TextBox8.Text = "" TextBox9.Text = "" End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click Dim cBuilder As New OleDb.OleDbCommandBuilder(dAdapter) Dim dsNewRow As DataRow dsNewRow = dSet.Tables("ProjectDB").NewRow() dsNewRow.Item("Numbers") = TextBox7.Text dsNewRow.Item("Message") = TextBox8.Text dsNewRow.Item("Hours") = TextBox9.Text dSet.Tables("ProjectDB").Rows.Add(dsNewRow) dAdapter.Update(dSet, "ProjectDB") dSet.Clear() dAdapter.Fill(dSet, "ProjectDB") MsgBox("Data Stored!") End Sub End Class
![]() |
Similar Threads
- Countdown Timer with minutes seconds and milliseconds! (Visual Basic 4 / 5 / 6)
- Help with countdown timer (VB.NET)
- Tkinter Countdown Timer problems. (Python)
- Pause/Restart Countdown Timer Question (VB.NET)
- Countdown Timer (VB.NET)
- timer countdown help (Visual Basic 4 / 5 / 6)
- Timer Countdown (C++)
- Countdown (Java)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Saving Mshflexgrid data columnwise in a table
- Next Thread: urjent-barcode reader
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






