Click here to Skip to main content
15,899,124 members
Home / Discussions / C#
   

C#

 
AnswerRe: Searching through an ArrayList Pin
Michael Sync10-Jul-07 21:29
Michael Sync10-Jul-07 21:29 
AnswerRe: Searching through an ArrayList Pin
Guffa10-Jul-07 21:49
Guffa10-Jul-07 21:49 
GeneralRe: Searching through an ArrayList Pin
Michael Sync10-Jul-07 22:18
Michael Sync10-Jul-07 22:18 
AnswerRe: Searching through an ArrayList Pin
Darkness8411-Jul-07 19:07
Darkness8411-Jul-07 19:07 
Questionhow to adjust designing part(.aspx)page Pin
srinivassam10-Jul-07 20:52
srinivassam10-Jul-07 20:52 
AnswerRe: how to adjust designing part(.aspx)page Pin
Vikram A Punathambekar10-Jul-07 22:30
Vikram A Punathambekar10-Jul-07 22:30 
QuestionListViewIten RightClick Pin
topksharma198210-Jul-07 20:49
topksharma198210-Jul-07 20:49 
Questionread from serialport problem Pin
supercsharp110-Jul-07 20:29
supercsharp110-Jul-07 20:29 
in my C# program,i input "at" in a textBox,then the program send "at" to serialport,but when i click receive button,the message I receive from serial port is the same as what I input,namely "at",not "ok",why?who can answer my question?How I solve this problem and get the right response "ok" from serial port?

next is my code:

public partial class Form1 : Form
{
private SerialPort sp = null;
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
try
{
sp = new SerialPort("COM1");
sp.ReadTimeout = 5000;
sp.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void button2_Click(object sender, EventArgs e)
{
try
{
sp.Write(textBox1.Text);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

private void button3_Click(object sender, EventArgs e)
{
try
{
/*string text=null;
char[] buffer = new char[10];
sp.Read(buffer,0,6);
for (int i = 0; i < buffer.Length; i++)
{
text += buffer[i];
}
textBox2.Text = text;*/

/*string text = null;
char t = (char)sp.ReadChar();
text+=t.ToString();
while (true)
{
t = (char)sp.ReadChar();
if (t == '\0') break;
else text += t.ToString();
}
textBox2.Text = text;*/

string text = null;
byte[] t = new byte[20];
char[] c = new char[20];
sp.Read(t, 0, t.Length);
sp.Read(t, 0, t.Length);
c = Encoding.ASCII.GetChars(t);
int i;
for (i = 0; i < c.Length; i++)
{
if (c[i] == 'O' || c[i] == 'K')
text += c[i].ToString();
}
textBox2.Text = text;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
AnswerRe: read from serialport problem Pin
Hesham Yassin10-Jul-07 22:24
Hesham Yassin10-Jul-07 22:24 
AnswerRe: read from serialport problem Pin
Luc Pattyn10-Jul-07 23:48
sitebuilderLuc Pattyn10-Jul-07 23:48 
QuestionHEX-values Pin
roiter10-Jul-07 20:10
roiter10-Jul-07 20:10 
AnswerRe: HEX-values Pin
Martin#10-Jul-07 20:17
Martin#10-Jul-07 20:17 
GeneralRe: HEX-values Pin
roiter10-Jul-07 20:27
roiter10-Jul-07 20:27 
GeneralRe: HEX-values Pin
Martin#10-Jul-07 20:28
Martin#10-Jul-07 20:28 
GeneralRe: HEX-values Pin
Luc Pattyn10-Jul-07 23:51
sitebuilderLuc Pattyn10-Jul-07 23:51 
AnswerRe: HEX-values Pin
Guffa10-Jul-07 20:53
Guffa10-Jul-07 20:53 
Questionpopulating combo box on selectedindex changedevent of other combo box1 Pin
monuSaini10-Jul-07 19:44
monuSaini10-Jul-07 19:44 
AnswerRe: populating combo box on selectedindex changedevent of other combo box1 Pin
valerian.precop10-Jul-07 20:38
valerian.precop10-Jul-07 20:38 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
monuSaini10-Jul-07 20:50
monuSaini10-Jul-07 20:50 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
Nisar Inamdar10-Jul-07 20:56
Nisar Inamdar10-Jul-07 20:56 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
monuSaini10-Jul-07 21:04
monuSaini10-Jul-07 21:04 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
Nisar Inamdar10-Jul-07 21:15
Nisar Inamdar10-Jul-07 21:15 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
monuSaini10-Jul-07 21:27
monuSaini10-Jul-07 21:27 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
Nisar Inamdar10-Jul-07 22:25
Nisar Inamdar10-Jul-07 22:25 
GeneralRe: populating combo box on selectedindex changedevent of other combo box1 Pin
valerian.precop10-Jul-07 21:25
valerian.precop10-Jul-07 21:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.