Avatar of Rama Tito
Rama Tito
Flag for Malaysia asked on

Convert code from visual basic 6 to C#

Hi, I need to change the code from vb 6 to C#. the code as follows

Private Sub MSComm1_OnComm()
Dim  inBuff as string

   If  MSComm1.CommEvent = comEvReceive Then
              inBuff = MSComm1.Input
End Sub
C#

Avatar of undefined
Last Comment
Todd Gerbert

8/22/2022 - Mon
TonyReba

private void MSComm1_OnComm()
{
      string inBuff = null;
if (MSComm1.CommEvent = comEvReceive)
{
inBuff = MSComm1.Input


}

}
ASKER CERTIFIED SOLUTION
kaufmed

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
kaufmed

@TonyReba

You have a syntax error on line 4  : )
TonyReba

true dat, hehe
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Todd Gerbert

The .Net Framework (e.g. C#) has some built-in support for serial communications, http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx, I would think the System.IO.Ports.SerialPort .Net class would be much more robust than the COM-based MsComm control.