-
Jun 23rd, 2011, 07:24 AM
#1
Thread Starter
Fanatic Member
clear hyperterminal in vb.net
please help,
in hyper teriminal when i press "ctrl+L" is to clear terminal screen
how to write the code in vb.net? Hyperterminal is connecting to serial comport
when i try this it work and return line on debug
Code:
serialport.writeline ("at+cmgl=1")
i try this but not work and it still show some lines on debug
Code:
serialport.writeline (vbcrtl +"L")
serialport.WriteLine("vbCrLf + l")
thanks
best regards,
-
Jun 23rd, 2011, 08:59 AM
#2
Re: clear hyperterminal in vb.net
It is not clear what you are trying to do. It looks like you were using HyperTerminal to talk to a device and then wanted to automate that with VisualBasic.
In basic terminal communications, like HyperTerminal, the control sequence, CTRL-L, is a FormFeed (ControlChars.FormFeed), which clears the screen.
SerialPort.Writexxx / .Readxxx does not have a concept of screen, only of bit streams.
-
Jun 23rd, 2011, 09:32 AM
#3
Thread Starter
Fanatic Member
Re: clear hyperterminal in vb.net
thanks for your ********
yes,it is. that is what i supposed to do to send a "ctrl + L" trying to clear hyperterminal data so that it is "empty" when i do serialport.readline command.
If serialport still got data it will read it when I accesing command "serialport.readine"
-
Jun 23rd, 2011, 10:41 AM
#4
Fanatic Member
Re: clear hyperterminal in vb.net
Clearing Hyperteminal has no effect on reading the serial port in your program -- anthing displayed in Hyperterminal has already been read and is no longer available from the serial port. However, you cannot have both Hyperterminal and your program both executing (with the serial port open), so I suspect that something else is going on.
Do you have terminal code in your own program that is displaying data? If so, then just clear the textbox that is displaying the data. If not, and you want to use a terminal program to display data, then add that code (I have example code on my website, www.hardandsoftware.net, in the Enhanced SerialPort download).
If you actually have Hyperterminal running, then... what you want to do is not practical. Do it some other way.
Dick
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Jun 23rd, 2011, 11:15 AM
#5
Thread Starter
Fanatic Member
Re: clear hyperterminal in vb.net
hi DickGrier
thanks for your response
i am using serialport.writeline ("at+cmgl=1") to access serialport and then using serialport.readline command to read from serialport.
Unfortunately, serialport.readline can read only 1 line each turn, the rest have few line left, and i suppose to clear the rest of it.
example:
Code:
SMSPort.WriteLine("AT+CMGL=1" & vbCr)
t1 = SMSPort.ReadLine() 'THIS READ FIRST LINE
t2 = SMSPort.ReadLine() 'THIS READ 2ND LINE
actually, the device have more than 2 line when i perform serialport.readline("at+cmgl=1"), this is I suposse to clear the rest (the 3rd line and more)
Regards,
-
Jun 23rd, 2011, 11:24 AM
#6
Fanatic Member
Re: clear hyperterminal in vb.net
IMO, you should add code to the DataAvailable event to read data. Then, do not use ReadLine, but instead use ReadExisting. You can double-buffer data to a String buffer by appending new data. Then either use the Substring method or the InStr function to scan the buffer for a vbCrLf. When you find a part of the string terminated by the carriage return/linefeed character pair (vbCrLf or ControlChars.NewLine), then display that line by invoking a delegate. Don't forget to remove any data from the String buffer that you already have displayed.
There are lots of examples of this sort of thing online.
Dicki
Richard Grier, Consultant, Hard & Software
Microsoft MVP (Visual Basic)
-
Jun 23rd, 2011, 11:26 AM
#7
Thread Starter
Fanatic Member
Re: clear hyperterminal in vb.net
[QUOT]
you cannot have both Hyperterminal and your program both executing (with the serial port open), so I suspect that something else is going on
[/QUOT]
yes, i am not open hyperterminal when my program accessing it, i am sorry for the title include hyperterminal, that must be reagarding serialport or whatever, idk
Regards,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|