locked
csharp windows form resize lost data RRS feed

  • Question

  • Hi every body,

    I'm using C# form to acquisition data from a USB card.

    The program works fine. But when I minimize my form to task bar and then restore it, the data were lost.

    My application using another thread to read data from USB card.

    I use windows XP sp3, C# 2010.

    How can I fix it?

    Thursday, February 28, 2013 9:13 AM

Answers

  • i guess, your USB drive is also a kind of drive present in the computer and you can use normal File operation on it. What is the approach you are using for this while using the thread? Maybe you can try to do the operation without using thread. Or you can try to handle the LostFocus() event of the form http://msdn.microsoft.com/en-us/library/system.windows.forms.control.lostfocus.aspx

    regards

    joon

    Thursday, February 28, 2013 9:31 AM
  • The lost data is the data of USB card sent to me.

    My system has one USB card to measure temperature, voltage of some inputs. The C# application will get these data, displaying on the textbox, and save to disk.

    When my form always appear, the data are ok, but if I minimize and restore the form, it lost some data and overlap some data.

    I think the problems is when I restore my form, my thread that reading data from USB card will be hang until C# redraw the form. (My form is very simple, only one menu bar, one textbox to display acquisition data, and one textbox to display debug information. Although I don't display acquisition data to textbox, the error will be still happened).

    USB card send to PC every 320bytes/100 miliseconds.

    Thursday, February 28, 2013 9:44 AM

All replies

  • Do you mean that the image of the window is lost? Which kinds of data are lost?

    Thursday, February 28, 2013 9:29 AM
  • i guess, your USB drive is also a kind of drive present in the computer and you can use normal File operation on it. What is the approach you are using for this while using the thread? Maybe you can try to do the operation without using thread. Or you can try to handle the LostFocus() event of the form http://msdn.microsoft.com/en-us/library/system.windows.forms.control.lostfocus.aspx

    regards

    joon

    Thursday, February 28, 2013 9:31 AM
  • The lost data is the data of USB card sent to me.

    My system has one USB card to measure temperature, voltage of some inputs. The C# application will get these data, displaying on the textbox, and save to disk.

    When my form always appear, the data are ok, but if I minimize and restore the form, it lost some data and overlap some data.

    I think the problems is when I restore my form, my thread that reading data from USB card will be hang until C# redraw the form. (My form is very simple, only one menu bar, one textbox to display acquisition data, and one textbox to display debug information. Although I don't display acquisition data to textbox, the error will be still happened).

    USB card send to PC every 320bytes/100 miliseconds.

    Thursday, February 28, 2013 9:44 AM