How to abstract data from textpad using vb

LiL_Is

Member
Joined
Jul 16, 2009
Messages
11
Programming Experience
Beginner
Hi all,

I am new to visual basic 2005. I have done how to abstract telephone from the sql server database and display it. But the problem is i could not do by abstracting the telephone number from the notepad. Hope that anyone could help.

Thanks.
 
Can you show us how it is stored in the file? Do you control how it is stored? Are there many numbers to parse out or just one?
 
Hi!

There are many numbers to store. Here is the code that i am using:

Thanks

Public Class Form1

Private WithEvents serialPort As New IO.Ports.SerialPort
Dim receivedData As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'---------------Display all the ports name which available-----------'
For i As Integer = 0 To _
My.Computer.Ports.SerialPortNames.Count - 1
cbbCOMPorts.Items.Add( _
My.Computer.Ports.SerialPortNames(i))
Next
btnDisconnect.Enabled = False
End Sub

Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
'---close the serial port if it is open---
If serialPort.IsOpen Then
serialPort.Close()
End If
Try
'---configure the various parameters of the serial port---
With serialPort
.PortName = cbbCOMPorts.Text
.BaudRate = 115200
.Parity = IO.Ports.Parity.None
.DataBits = 8
.StopBits = IO.Ports.StopBits.One
'-----set the encoding to Unicode-----
.Encoding = System.Text.Encoding.Unicode

End With
'---open the serial port---
serialPort.Open()
'---update the status of the serial port and
' enable/disable the buttons---
lblShow.Text = cbbCOMPorts.Text & " connected."
btnConnect.Enabled = False
btnDisconnect.Enabled = True
Catch ex As Exception
MsgBox(ex.ToString)
End Try

End Sub

Private Sub btnDisconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisconnect.Click
Try
'---close the serial port---
serialPort.Close()
'---update the status of the serial port and
' enable/disable the buttons---
lblShow.Text = serialPort.PortName & " disconnected."
btnConnect.Enabled = True
btnDisconnect.Enabled = False
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub

Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click

serialPort.Write("AT+CMGS=" & RichTextBox1.Text & vbCrLf & TextBox1.Text & Chr(26)) 'set command message format to text mode(1)
MsgBox("Message has been sent")

End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
serialPort.Write("AT" & vbCrLf) 'set command message format to text mode(1)

End Sub

Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
serialPort.Write("AT+CMGF=1" & vbCrLf) 'set command message format to text mode(1)

End Sub

'Private Sub btnTo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTo.Click
' Me.Hide()
' Form2.Show()
'End Sub

End Class
 
Back
Top