Click here to Skip to main content
15,851,242 members
Home / Discussions / C#
   

C#

 
QuestionRe: Nullable foreign key causes runtime error in OData service Pin
Richard MacCutchan29-Aug-23 7:21
mveRichard MacCutchan29-Aug-23 7:21 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Alex Wright 202229-Aug-23 7:47
Alex Wright 202229-Aug-23 7:47 
GeneralRe: Nullable foreign key causes runtime error in OData service Pin
Dave Kreskowiak29-Aug-23 12:52
mveDave Kreskowiak29-Aug-23 12:52 
GeneralRe: Nullable foreign key causes runtime error in OData service Pin
Richard MacCutchan29-Aug-23 22:18
mveRichard MacCutchan29-Aug-23 22:18 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Richard Deeming29-Aug-23 22:14
mveRichard Deeming29-Aug-23 22:14 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Gerry Schmitz30-Aug-23 11:25
mveGerry Schmitz30-Aug-23 11:25 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Mycroft Holmes30-Aug-23 13:44
professionalMycroft Holmes30-Aug-23 13:44 
QuestionCom port c#, windows form Pin
Jan 194728-Aug-23 2:16
Jan 194728-Aug-23 2:16 
Hi Guys,
I am not expert and will be glad to get some help. I wrote software, where I am using Barcode reader, com port, in number of Windows forms. I am switching receive data on Form Activation and disabling it on Form deactivated. it has worked well for number of months, but now I am occasionally get error, Com port is not accessible. Received I use Invoke.
<pre>        private void CheckForUsbDevice()
        {

            string[] ports = SerialPort.GetPortNames();

            // Display each port name to the console.
            foreach (string port in ports)
            {
                if ((port == "COM3") || (port == "COM4"))
                {
                    if (AcdStart.mySerialPort == null)
                    {
                        AcdStart.mySerialPort = new SerialPort(port)
                        {
                            BaudRate = 9600,
                            Parity = Parity.None,
                            StopBits = StopBits.One,
                            DataBits = 8,
                            Handshake = Handshake.None,
                            RtsEnable = true
                        };
                    }
                         AcdStart.mySerialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
                    if (!AcdStart.mySerialPort.IsOpen)
                    {
                        AcdStart.mySerialPort.Close();
                        AcdStart.mySerialPort.Open();
                    }
                        PortTextBox.Text = (string.Format("Port {0}", port));
                    break;
                }
            }
        }


private void RxPurchaseOrder_Deactivate(object sender, System.EventArgs e)
{
    if ((AcdStart.mySerialPort != null) && (AcdStart.mySerialPort.IsOpen))
        AcdStart.mySerialPort.DiscardInBuffer();

    if (AcdStart.mySerialPort != null)
    {
        AcdStart.mySerialPort.DataReceived -= new SerialDataReceivedEventHandler(DataReceivedHandler);
        AcdStart.mySerialPort.Close();
    }
    AcdStart.mySerialPort = null;
    PauseNow = true;
    this.BackColor = Color.LightSalmon;
}

private void RxPurchaseOrder_Activated(object sender, EventArgs e)
{
    if ((AcdStart.mySerialPort != null) && (AcdStart.mySerialPort.IsOpen))
    {
        AcdStart.mySerialPort.DiscardInBuffer();
        if (AcdStart.mySerialPort.IsOpen)
            AcdStart.mySerialPort.Close();


        AcdStart.mySerialPort = null;
    }
    PortTextBox.Text = "";
    CheckForUsbDevice();
    PauseNow = false;
    this.BackColor = Color.LightSteelBlue;
}

I hope I have indicated flow of the basics. I am self learning pensioner ... apologize in advance and thanks for any help and suggestions.
regards John
AnswerRe: Com port c#, windows form Pin
Richard MacCutchan28-Aug-23 5:44
mveRichard MacCutchan28-Aug-23 5:44 
GeneralRe: Com port c#, windows form Pin
Jan 194728-Aug-23 12:21
Jan 194728-Aug-23 12:21 
AnswerRe: Com port c#, windows form Pin
Gerry Schmitz28-Aug-23 7:44
mveGerry Schmitz28-Aug-23 7:44 
GeneralRe: Com port c#, windows form Pin
Jan 194728-Aug-23 12:12
Jan 194728-Aug-23 12:12 
GeneralRe: Com port c#, windows form Pin
Gerry Schmitz28-Aug-23 15:43
mveGerry Schmitz28-Aug-23 15:43 
GeneralRe: Com port c#, windows form Pin
Jan 194728-Aug-23 17:13
Jan 194728-Aug-23 17:13 
Questionlimiting recursion as two interdependent values change c# Pin
BillWoodruff27-Aug-23 2:15
professionalBillWoodruff27-Aug-23 2:15 
GeneralRe: limiting recursion as two interdependent values change c# Pin
harold aptroot27-Aug-23 14:14
harold aptroot27-Aug-23 14:14 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 4:41
professionalBillWoodruff28-Aug-23 4:41 
GeneralRe: limiting recursion as two interdependent values change c# Pin
harold aptroot28-Aug-23 5:55
harold aptroot28-Aug-23 5:55 
GeneralRe: limiting recursion as two interdependent values change c# Pin
Gerry Schmitz28-Aug-23 7:50
mveGerry Schmitz28-Aug-23 7:50 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 12:08
professionalBillWoodruff28-Aug-23 12:08 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 12:13
professionalBillWoodruff28-Aug-23 12:13 
GeneralRe: limiting recursion as two interdependent values change c# Pin
harold aptroot28-Aug-23 13:36
harold aptroot28-Aug-23 13:36 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 23:48
professionalBillWoodruff28-Aug-23 23:48 
QuestionC# error when I try to run Pin
Member 1607362720-Aug-23 19:22
Member 1607362720-Aug-23 19:22 
AnswerRe: C# error when I try to run Pin
OriginalGriff20-Aug-23 19:27
mveOriginalGriff20-Aug-23 19:27 

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.