TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
deepender singla
NA
113
76.6k
How to close console screen
Jul 25 2011 10:29 AM
,
Hello members
This question might look silly to you , but i am a newbie i have the code given below when i run this the console screen doesnot get closed down i think that might be because of APPLICATION RUN in my code , but if i don't use that the last part of code from
private void port_DataReceived(object sender,
SerialDataReceivedEventArgs e)
till last does not execute. what should i do , plz help.
/////////////////////////my code///////////////////////////////////
#region Namespace Inclusions
using System;
using System.IO.Ports;
using System.Windows.Forms;
#endregion
namespace SerialPortExample
{
class SerialPortProgram
{
// Create the serial port with basic settings
private SerialPort port = new SerialPort("COM4",
9600, Parity.None, 8, StopBits.One);
[STAThread]
static void Main(string[] args)
{
// Instatiate this class
new SerialPortProgram();
}
private SerialPortProgram()
{
//Console.WriteLine("Incoming Data:");
// Attach a method to be called when there
// is data waiting in the port's buffer
port.DataReceived += new
SerialDataReceivedEventHandler(port_DataReceived);
// Begin communications
port.Open();
// Enter an application loop to keep this thread alive
Application.Run();
}
private void port_DataReceived(object sender,
SerialDataReceivedEventArgs e)
{
// Show all the incoming data in the port's buffer
Console.WriteLine(port.ReadExisting());
port.Close();
}
}
}
Reply
Answers (
3
)
Select *.log or *.doc files from directory in remote system using FTP
C# Embedding IronPython?