How to copy data from serial port to notepad,by the save button on the form without calling notead to write it in ,can we directly place the data to notepad from textbox which receving data.
thank u wating for reply

Recommended Answers

All 13 Replies


To Get Data from Serial Port use "MSComm" Control.

Yes u can write directly into Note Pad, Open the TextFile using "Open" key word, Write by using "Print"
Or Else
U can also use "File Scripting Objects" to write to Notepad.


thanx Qveena , iam using mscomm i am retreving data but how to use open keyword in save button can u show me syntax for it . i am trying to use it thank u

i am using this syntax by using scripting object
Dim fsys As New FileSystemObject
Dim Txtfl As TextStream
Set Txtfl = fsys.CreateTextFile(App.Path & "\" & "New Text Document.txt", True)
''Txtfl.WriteLine Text1.Text
Txtfl.WriteLine Text2.Text
it displaying the text2 value on the Form ,on which i there is a mistake in the Path specification i have kept "New Text Document.txt" text in the C:\Program Files\Microsoft Visual Studio\VB98 but is the path is write
thank u

I am also tryed using open keyword
open "NewTextDocument.txt" For Random As ..
what we have to write for,For Random As ..
it ask for as keyword here wat we have to mention

Sorry veena it work 's using FileSystemobject
my mistake at defining the path for it
thank u can we add string befor pasting text data to file like if i outputing the data then in the file it should look
Output Text1.Text value
Input Text2.Text value can we do this way

Hi Jatinder,

Sorry for not following up this post...

OK If u want to use File hanling with "I/O" then, open File this way:

Dim FN As Long
FN = FreeFile
Open "c:\MtFile.txt" For Output As FN
'(Here File will be OverWritten)
Open "c:\MtFile.txt" For Append As FN
'(here u can modify into ths same File)
Add data to file:
Print #FN, "My First File"

If u want to read TextFile:
Open "c:\MyFile.txt" For Input As FN
Dim TStr As String
Line Input FN, TStr

And After all the operations, u need to close them :
Close FN


thank u veena i tryed with u r last post on saturday which work for me .I want to know something about Needdle whih will show some fluxation when it will recieve some data ,how's the car speed shows .Is there is any control in vb6 which can be used .And i am also using Slider control in vertical position ,my problem in this it showing it 0 value at the top and maximam value at the bottom ,I want to change this setting 's i want to bring min value to bottom and max val to the top of the slider ie is from bottom to top bottom should be 0 and top should be 250 is there is any other slider we can use .Important to know about Needle Control.


Instead of Slider, why dont u use a
"Flat ScrollBar"
which comes with "Microsoft Windows Common Control 2 6.0"
Make Oientation = 0 (Verical)
and give Min / Max.

For the Visual Speed, Use a Line Control and a Shape(Circle) Control, Place the Line as the adius of circle, Change the CoOrdinates (X1,Y1) of Line Control Proprtionate to the speed. keeping (X2,Y2) Fixed....


But if some data coming from port thus this line control will very according to data .


Yes, u need to find co-ordinates of "X1, Y1" and change, Calculate Co0ord of Circumference of the Circle according to "Angle" in ur case Speed


Hello guys,

I have to log the data flowing between com ports of my instrument, through a bus, using datatap. I have to keep reading the datatap and log the data into a bin file. Also i have to capture the real time data like timestamp from the COM4 of the instrument along with data from datatap. Pls help me out as am formally familiar with VB and not much aware of Comm controls. can this required implementation be done in VB?

thanks in advance.

hi QVeen,

Am new to VB. I have learnt a lot following ur threads.
Need ur help. I have to tap data from 2 com ports from a instrument.
How can i read the data and store it into a bin file so that it can be decoded again at a later point of time. Am using VB 6.0.


Hi pbosek.

Start a New Thread for a New Question, otherwise your Question may go Un-noticed.

Anyway, Yes, if you want to Get Data from 2 Com ports, you have to place 2 MSComm controls on the Form. Configure them,
After Start, Store the Incoming data in 2 Seperate Text Files using FSO or Text I/O.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.