Create a BackgroundThread for processing the file. If you are storing the data read from the file in memory, make sure it does not consume too much ( Check the return value of FileStream.Read which returns the number of bytes read and add them to a "long totalBytesRead = 0;" variable each time as "totalBytesRead += bytesRead" and check:
if(totalBytesRead <= (1024*1024*50)) // more than 50 MB
CleanMemory(); // reset the read buffer forexample
if (xtr.NodeType == XmlNodeType.Element)
the <Days>21,"21"</Days> was just test data, I was trying to use the <Days>20</Days> but that gave me just the blank drop down box, so i was wondering if it just took my numbers and made them the index of the combobox so I put a few different data formats in the XML file to see if that made any difference
I have used a switch statement to check for XmlNodeType.Element and gives same results, if I change .equals("days") to an name that is not in the file I just get one blank drop down, currently it looks like it see that there are the right number of records but no data in the drop down
I know that you are not trying to save back the user modified values to the XML file. What I suggest using Convert is to give you the ability to store the datatype of the object(what ever you create) as a string value and then convert it to what you want. You may also write a custom type converter or implement iSerializable interface or add XmlAttributes to your fields for which you want to serialize.
I've been trying to a simple Comm program to work using the
ReadExisting method of the .Net 2.0 SerialPort class.
The data is being transmitted to me from a PIC micro dev board.
The data received event fires when ReceivedBytesThreshold is
reached as it should, but I only get back one character when there are
4 in the buffer. I verified this by retrieving the BytesToRead
property and it is set to 4.
If I add additional ReadExisting method calls afterwards I will get
one and only one char back for each read.
I also tried the Read method but same result as ReadExisting.
Lastly I ran Hyperterm and another terminal program
and they both receive the entire 4 chars with no problems.
The databits, baudrate, and handshaking are all set the same
for my code as well as the terminal programs. I have also
tried setting the DtrEnable and RtsEnable to true but with
sorry for the long post but i tried to be as brief as possible
SerialPort.Read documentation contains following note:
"Because the SerialPort class buffers data, and the stream contained in the BaseStream property does not, the two might conflict about how many bytes are available to read. The BytesToRead property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the BaseStream property because they have been buffered to the SerialPort class."
If you want specific help, show all code involved + port settings + actual bytes received.
I understand the documentation but that does not explain why I never got
the data. It would explain it if I only checked one time.
I ran the release version of .exe and I receive data without any changes to
existing code. However the reception rate is very slow compared to
something like hyperterm. I ran another Serial Terminal program
that I downloaded from an article on CodeProject and it does the same
thing. I think I may need to play with the read timeouts. So far
Im not very impressed with .Net's support for serial ports. [rant] I have
probably done something similiar to this at least 10 times before
on other platforms or development environments including Visual C++
and never had so much trouble. [end of rant]
What i want is that whenever i add new form in my application using Visual studio, it should appear in some different color and contains some different icon than what VS adds in default. Plz tell me how