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

C#

 
QuestionRe: Nullable foreign key causes runtime error in OData service Pin
Richard MacCutchan29-Aug-23 6:21
mveRichard MacCutchan29-Aug-23 6:21 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Alex Wright 202229-Aug-23 6:47
Alex Wright 202229-Aug-23 6:47 
GeneralRe: Nullable foreign key causes runtime error in OData service Pin
Dave Kreskowiak29-Aug-23 11:52
mveDave Kreskowiak29-Aug-23 11:52 
GeneralRe: Nullable foreign key causes runtime error in OData service Pin
Richard MacCutchan29-Aug-23 21:18
mveRichard MacCutchan29-Aug-23 21:18 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Richard Deeming29-Aug-23 21:14
mveRichard Deeming29-Aug-23 21:14 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Gerry Schmitz30-Aug-23 10:25
mveGerry Schmitz30-Aug-23 10:25 
AnswerRe: Nullable foreign key causes runtime error in OData service Pin
Mycroft Holmes30-Aug-23 12:44
professionalMycroft Holmes30-Aug-23 12:44 
QuestionCom port c#, windows form Pin
Jan 194728-Aug-23 1:16
Jan 194728-Aug-23 1: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 4:44
mveRichard MacCutchan28-Aug-23 4:44 
GeneralRe: Com port c#, windows form Pin
Jan 194728-Aug-23 11:21
Jan 194728-Aug-23 11:21 
AnswerRe: Com port c#, windows form Pin
Gerry Schmitz28-Aug-23 6:44
mveGerry Schmitz28-Aug-23 6:44 
GeneralRe: Com port c#, windows form Pin
Jan 194728-Aug-23 11:12
Jan 194728-Aug-23 11:12 
GeneralRe: Com port c#, windows form Pin
Gerry Schmitz28-Aug-23 14:43
mveGerry Schmitz28-Aug-23 14:43 
GeneralRe: Com port c#, windows form Pin
Jan 194728-Aug-23 16:13
Jan 194728-Aug-23 16:13 
Questionlimiting recursion as two interdependent values change c# Pin
BillWoodruff27-Aug-23 1:15
professionalBillWoodruff27-Aug-23 1:15 
GeneralRe: limiting recursion as two interdependent values change c# Pin
harold aptroot27-Aug-23 13:14
harold aptroot27-Aug-23 13:14 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 3:41
professionalBillWoodruff28-Aug-23 3:41 
GeneralRe: limiting recursion as two interdependent values change c# Pin
harold aptroot28-Aug-23 4:55
harold aptroot28-Aug-23 4:55 
GeneralRe: limiting recursion as two interdependent values change c# Pin
Gerry Schmitz28-Aug-23 6:50
mveGerry Schmitz28-Aug-23 6:50 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 11:08
professionalBillWoodruff28-Aug-23 11:08 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 11:13
professionalBillWoodruff28-Aug-23 11:13 
GeneralRe: limiting recursion as two interdependent values change c# Pin
harold aptroot28-Aug-23 12:36
harold aptroot28-Aug-23 12:36 
GeneralRe: limiting recursion as two interdependent values change c# Pin
BillWoodruff28-Aug-23 22:48
professionalBillWoodruff28-Aug-23 22:48 
QuestionC# error when I try to run Pin
Member 1607362720-Aug-23 18:22
Member 1607362720-Aug-23 18:22 
AnswerRe: C# error when I try to run Pin
OriginalGriff20-Aug-23 18:27
mveOriginalGriff20-Aug-23 18: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.