Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating an instance of an object ... Pin
John Kuhn7-Feb-04 8:34
John Kuhn7-Feb-04 8:34 
GeneralRe: Creating an instance of an object ... Pin
Heath Stewart7-Feb-04 19:23
protectorHeath Stewart7-Feb-04 19:23 
GeneralRe: Creating an instance of an object ... Pin
Andres Coder7-Feb-04 19:48
Andres Coder7-Feb-04 19:48 
GeneralRe: Creating an instance of an object ... Pin
Heath Stewart7-Feb-04 19:51
protectorHeath Stewart7-Feb-04 19:51 
GeneralDynamic attributes in datagrid. Pin
Andrlage7-Feb-04 3:05
Andrlage7-Feb-04 3:05 
GeneralRe: Dynamic attributes in datagrid. Pin
Mazdak7-Feb-04 3:46
Mazdak7-Feb-04 3:46 
GeneralRe: Dynamic attributes in datagrid. Pin
Bill Dean7-Feb-04 4:01
Bill Dean7-Feb-04 4:01 
GeneralHelp with MSComm serial port communications Pin
maria_p6-Feb-04 19:37
maria_p6-Feb-04 19:37 
HELP please someone I'm using MSComm with C#.....at the moment I'm communicating via a null modem connection between 2 PCs. At the moment I'm just sending out some bytes from one PC to another PC... Got the communication to work... all is well.

The problem; I only expect something to be sent from one PC to other when I press a button on the sending PC which then uses the command object.Output= new byte [] {a number}; to send a byte to the other computer.... the recieving computer in turn recieves this and displays it via the ONComm event handler. The ONComm event on the recieving PC is raised when a byte arrives at the recieving PC serial port on pressing a button on the sending PC.... HOWEVER the ONComm Event is also raised (on the recieving PC)when I start up and exit the sending application. I just can't understand this! This could obviously be a really big problem... Can someone explain or have a solution to this? I would be grateful... I just can't seem to stop this event from raising when the sending application starts up or shuts down... This could be reallly disasterous if the sending PC sends something on start up (ie without me even having instructed the sending application to output a signal by pressing a button) when connected to a PICmicrocontroller which shouldn't recieve that signal....

Here is how i set up the 2 PCs;

com.CommPort = 1;
if (com.PortOpen) com.PortOpen = false;
com.RThreshold = 1;
com.Settings = "9600,n,8,1";
//com.DTREnable = true;
com.Handshaking = MSCommLib.HandshakeConstants.comNone;
com.InputMode = MSCommLib.InputModeConstants.comInputModeBinary;
com.InputLen = 0;
com.NullDiscard = false;
com.OnComm += new System.EventHandler(this.OnComm);
com.PortOpen = true;

Here is the ONComm event handler on the recieving PC which is connected with a null modem cable;

// MSCommLib OnComm Event Handler
private void OnComm(object sender, EventArgs e)
{
//Message box 1
MessageBox.Show("recieved something 1");

switch (com.CommEvent)
{
case (short)MSCommLib.OnCommConstants.comEvReceive:
//Message box 2
MessageBox.Show("recieved something 2");

byte[] x = (byte[]) com.Input;
foreach (byte byt in x)
{
strrecvd += (char) byt;
//Message box 3
MessageBox.Show(strrecvd);........................

The only Message box that should show on the recieving PC is 3 and that only when I press a button to send a byte on the sending PC... However on the inclusion of message boxes 1 and 2 I noticed that when I started up or shut down the sending application they would show on the recieving PC.... Frown | :(
anyone?
I would never have known this happens had i not put a message box there to check something else...SCARY!

maria (phillips_maria2@hotmail.com)
GeneralConversion From VB Pin
Josh Koppang6-Feb-04 17:42
Josh Koppang6-Feb-04 17:42 
GeneralRe: Conversion From VB Pin
Bill Dean6-Feb-04 18:12
Bill Dean6-Feb-04 18:12 
Questionis their any way to ..................? Pin
6-Feb-04 13:27
suss6-Feb-04 13:27 
AnswerRe: is their any way to ..................? Pin
Colin Angus Mackay7-Feb-04 3:05
Colin Angus Mackay7-Feb-04 3:05 
AnswerRe: is their any way to ..................? Pin
Heath Stewart7-Feb-04 19:28
protectorHeath Stewart7-Feb-04 19:28 
AnswerRe: is their any way to ..................? Pin
13-Feb-04 6:39
suss13-Feb-04 6:39 
GeneralIncrementally create user controls Pin
Andrlage6-Feb-04 12:16
Andrlage6-Feb-04 12:16 
GeneralRe: Incrementally create user controls Pin
Colin Angus Mackay7-Feb-04 3:13
Colin Angus Mackay7-Feb-04 3:13 
GeneralRe: Incrementally create user controls Pin
Andres Coder7-Feb-04 7:41
Andres Coder7-Feb-04 7:41 
GeneralRe: Incrementally create user controls Pin
Andres Coder7-Feb-04 7:42
Andres Coder7-Feb-04 7:42 
Generalenter Pin
heba_zien6-Feb-04 11:14
heba_zien6-Feb-04 11:14 
GeneralRe: enter Pin
Bill Dean6-Feb-04 17:01
Bill Dean6-Feb-04 17:01 
QuestionIs implementing WH_KEYBOARD hooking in a .NET library a good idea? Pin
Anonymous6-Feb-04 10:34
Anonymous6-Feb-04 10:34 
AnswerRe: Is implementing WH_KEYBOARD hooking in a .NET library a good idea? Pin
Heath Stewart7-Feb-04 19:32
protectorHeath Stewart7-Feb-04 19:32 
GeneralRe: Is implementing WH_KEYBOARD hooking in a .NET library a good idea? Pin
Anonymous7-Feb-04 22:38
Anonymous7-Feb-04 22:38 
GeneralRe: Is implementing WH_KEYBOARD hooking in a .NET library a good idea? Pin
Heath Stewart8-Feb-04 5:41
protectorHeath Stewart8-Feb-04 5:41 
QuestionAny Articles on Delta values (saving only what has changed)? Pin
Grav-Vt6-Feb-04 9:49
Grav-Vt6-Feb-04 9:49 

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.