Click here to Skip to main content
15,884,971 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Gerry Schmitz23-Jan-17 8:39
mveGerry Schmitz23-Jan-17 8:39 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu23-Jan-17 18:13
professionalTarunKumarSusarapu23-Jan-17 18:13 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Gerry Schmitz23-Jan-17 19:07
mveGerry Schmitz23-Jan-17 19:07 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu24-Jan-17 0:52
professionalTarunKumarSusarapu24-Jan-17 0:52 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
Gerry Schmitz24-Jan-17 2:36
mveGerry Schmitz24-Jan-17 2:36 
AnswerRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
palikhelsanjeeb25-Jan-17 21:13
palikhelsanjeeb25-Jan-17 21:13 
GeneralRe: How to save values in table in SQL without crashing when it is used by multiple users Pin
TarunKumarSusarapu29-Jan-17 19:00
professionalTarunKumarSusarapu29-Jan-17 19:00 
QuestionHaving trouble closing and reopening of communication port RS232 Pin
goldsoft21-Jan-17 1:40
goldsoft21-Jan-17 1:40 
hi
I'm trying to get the weight attached to a computer using RS232 com port.

I can read the weighing, but when I walk out the form , and came again -

My program and computer freezing.

this is my code:
private void Main_Load(object sender, EventArgs e)
{ 
    port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
    port.DataReceived += new s system.IO.Ports.SerialDataReceivedEventHandler(Recepcion);

    if (port.IsOpen == false)
    {
      try
      {
         port.Open();
      }
      catch (Exception oex)
      {
          MessageBox.Show(oex.ToString());
      }
    }
}

private void Actualizar(object s, EventArgs e)
{
   //I try this
   lblMSG.Text = ExtractDecimalFromString(port.ReadLine()).ToString();
   port.DiscardInBuffer();

   //Also I try this
   lblMSG.Text = ExtractDecimalFromString(port.ReadExisting()).ToString();
   port.DiscardInBuffer();
}

private void Recepcion(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
  try
  {
     this.Invoke(new EventHandler(Actualizar));
  }
  catch { }
}

and when i close the form i do this:
 port.DataReceived -= new System.IO.Ports.SerialDataReceivedEventHandler(Recepcion);

GC.Collect();   //also i try to remark this
port.Close();
port.Dispose();
this.Close();

It is not always freezes, sometime yes...sometime no....

I searched the entire network still does not answer and solution.

I'm really despair. I wish to find a solution here
AnswerRe: Having trouble closing and reopening of communication port RS232 Pin
Afzaal Ahmad Zeeshan21-Jan-17 2:04
professionalAfzaal Ahmad Zeeshan21-Jan-17 2:04 
GeneralRe: Having trouble closing and reopening of communication port RS232 Pin
goldsoft22-Jan-17 10:19
goldsoft22-Jan-17 10:19 
AnswerRe: Having trouble closing and reopening of communication port RS232 Pin
Bernhard Hiller22-Jan-17 21:20
Bernhard Hiller22-Jan-17 21:20 
AnswerRe: Having trouble closing and reopening of communication port RS232 Pin
Gerry Schmitz23-Jan-17 8:17
mveGerry Schmitz23-Jan-17 8:17 
QuestionC# Project Suggestion ! Pin
TEProjects20-Jan-17 23:49
professionalTEProjects20-Jan-17 23:49 
AnswerRe: C# Project Suggestion ! Pin
Richard MacCutchan21-Jan-17 0:06
mveRichard MacCutchan21-Jan-17 0:06 
GeneralRe: C# Project Suggestion ! Pin
TEProjects23-Jan-17 1:41
professionalTEProjects23-Jan-17 1:41 
AnswerRe: C# Project Suggestion ! Pin
NotPolitcallyCorrect21-Jan-17 1:14
NotPolitcallyCorrect21-Jan-17 1:14 
GeneralRe: C# Project Suggestion ! Pin
TEProjects23-Jan-17 1:43
professionalTEProjects23-Jan-17 1:43 
GeneralRe: C# Project Suggestion ! Pin
Pete O'Hanlon23-Jan-17 1:49
mvePete O'Hanlon23-Jan-17 1:49 
GeneralMessage Closed Pin
23-Jan-17 1:50
professionalTEProjects23-Jan-17 1:50 
GeneralRe: C# Project Suggestion ! Pin
Pete O'Hanlon23-Jan-17 1:53
mvePete O'Hanlon23-Jan-17 1:53 
AnswerRe: C# Project Suggestion ! Pin
Afzaal Ahmad Zeeshan21-Jan-17 1:50
professionalAfzaal Ahmad Zeeshan21-Jan-17 1:50 
GeneralRe: C# Project Suggestion ! Pin
TEProjects23-Jan-17 1:44
professionalTEProjects23-Jan-17 1:44 
AnswerRe: C# Project Suggestion ! Pin
BillWoodruff22-Jan-17 15:01
professionalBillWoodruff22-Jan-17 15:01 
GeneralRe: C# Project Suggestion ! Pin
TEProjects23-Jan-17 1:48
professionalTEProjects23-Jan-17 1:48 
GeneralRe: C# Project Suggestion ! Pin
BillWoodruff23-Jan-17 23:49
professionalBillWoodruff23-Jan-17 23: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.