Threading

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nmsreddi
    Contributor
    • Jul 2006
    • 366

    Threading

    Hello

    i am working with C#2005 where my requirement is to send and receive data through serial port.i have succeded in that part ,but my second task is to splict the received data and insert into data base where exactly i am facing this problem

    Code:
    ///my code for received data
    
    private void port_DataReceived(object sender, SerialDataReceivedEventArgs e)
    
    {// Event for receiving data
    
    // Read the buffer to text box.
    
    this.Invoke(new EventHandler(DoUpdate));
    
    }
    
    private void DoUpdate(object s, EventArgs e)
    
    {
    
    statusBar1.Text = "Getting Data";
    
    statusBar1.Refresh();
    
    RichtextBox1.Text = RichtextBox1.Text + port.ReadExisting();
    
    string s=port.ReadExisting();
    
    if(s.Length>60)
    {
    
    //my code for other validations go here
    // i will call here the split method
    
    Split();
    
    // inthis split method i am inserting data in to database
    }
    }
    in the code i posted ,the code in the Split(); is only getting executed when ever i place a break point there with out break poing my application is running fine but that split method is not getting executed .

    i tried for this alot in google but no use i am unable find the actual problem

    can any one there with some suggestion

    i am not getting any exception or any error other then that method is skipped when there is no break point

    Regards

    NMsreddi
    Last edited by kenobewan; Feb 27 '07, 12:02 PM. Reason: Add code tags
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Here is an article that may help:
    String.Split

    Comment

    • nmsreddi
      Contributor
      • Jul 2006
      • 366

      #3
      Hello

      My problem is not in splitting the data ,my method works well for that

      the method by name split is not executing unless i keep a break poin t

      there i think i have to attach any process for that

      i hope my problem is clear now

      any suggestion please......

      Regards

      NMsreddy

      Comment

      • kenobewan
        Recognized Expert Specialist
        • Dec 2006
        • 4871

        #4
        Have you written the value of s.length to see whether it is > 60?

        Comment

        • nmsreddi
          Contributor
          • Jul 2006
          • 366

          #5
          hello

          Yes i am taking the the length of string s .

          length of string s may vary from 5 to 150 but i want to consider messages of

          length that greater than 60 characters only

          i am able to get in to that loop when i keep a break point at that loop

          if i remove that break point the loop is never getting executed

          Hope the problem is clear

          Regards
          NMsreddy

          Comment

          Working...