|
Do you know what you want?
This is your post:
Thanks for the info, i got the loading of the combobox working, i am not trying to figure out how to save the changes back to the xml file if the user changes the value.
And now you are saying:
yes I am trying to save back the user modified values. I'm updating a config file so when the program is shutdown the changed value is read the next time the program is run.
Are you OK?
|
|
|
|
|
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
no success.
sorry for the long post but i tried to be as brief as possible
Any help will be greatly appreciated.
|
|
|
|
|
Hi, since ReadExisting reads bytes but returns a string, I would guess you have a problem with
the encoding. Why dont you use Read(byte[],...) ?
|
|
|
|
|
Its possible but then why do the successive ReadExisting invocations
return the characters that were sent? I will give it a try.
|
|
|
|
|
|
Hi,
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]
|
|
|
|
|
Dear Friends,
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
Imtiaz
|
|
|
|
|
hi
i'm not sure that i got your question but may you can use visual studio templates
then you can add your custom form in 'Add' dialog box instead traditional windows form
I Wish the Life Had CTRL-Z
|
|
|
|
|
How can I copy a file and preserve the creation date?
|
|
|
|
|
i know a trick with MS-Dos command prompt but i think it will not be usefull for you
however if you didn't find your answer try System.IO.Directory.SetCreationTime
as your last solution
I Wish the Life Had CTRL-Z
|
|
|
|
|
Hi,
Explorer when copying a file sets creation time current,
but preserves last modified time (which seems logical).
And I assume File.Copy does the same.
AFAIK there is no function that does it differently.
You could make a method that copies a file and restores some
of the file properties, e.g. by using File.Get/SetCreationTime.
Regards,
|
|
|
|
|
Yeah! I am now using Western Digital drive mirroring but it is not convienent. Did a thirty day agricultral experiment that required date and time of each picture to be recorded. Did not realize that this data would be lost when the images were transfered from the chip to the hard drive. Lost thirty days work.
Guess Ile have to write a piece of software for this.
|
|
|
|
|
Two ideas:
If the file is created and written only once (i.e. not modified afterwards) on a Windows
system, then the "last written" or "modification" date should not change when the file
gets copied by either Win Explorer or File.Copy
If your pictures are JPEG files generated by a camera, it is very likely they contain a lot
of "properties" including the date & time of exposure (assuming the camera's real-time clock
has been initialized correctly...).
|
|
|
|
|
Luc
Thanks the modified date is correct for all the pics. So I will be able to salvage my work. Some how modified does not seem to be good terminology for when a picture is taken but thats MS for ya. I still am going to write a copy utility for my own use. The code below seems to work. Any Suggestions.
<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
string infile="";<br />
string outfile = "C:\\test.jpg";<br />
OpenFileDialog dlg = new OpenFileDialog();<br />
if (dlg.ShowDialog() == DialogResult.OK)<br />
{<br />
infile = dlg.FileName;<br />
File.Copy(infile, outfile, true);<br />
File.SetCreationTime(outfile,File.GetCreationTime(infile));<br />
} <br />
}<br />
-- modified at 17:54 Saturday 5th May, 2007
|
|
|
|
|
Hi,
1. file times
creation time is when the file got created
modification time is when the file contents last have been modified
and yes that can be before creation time (when file gets copied, as you have experienced).
2. code comments
I would put infile declaration and all actions inside the OK? test
3. JPEG
as I said before, JPEG files typically contain a lot of properties, which may be the safest way
to retrieve exposure information. If you want to make sure for your files, just mail me one.
Regards
|
|
|
|
|
Hi,
digital cameras add a lot of information into the JPEG files they generate.
This info is loaded into the Image object when executing Image.FromFile(filespec).
The info can be interrogated, item by item, by calling Image.GetPropertyItem(itemID).
AFAIK the info is preserved (not updated) when such image gets operated upon;
So as long as you modify and then save the Image to another file, you will still have
all the original properties, which may have become invalid, since they contain size,
datetime, etc, which may have been modified or become meaningless by the applied modifications.
When you create a new image from an existing one, as in new Bitmap(myImage),
the properties are not copied.
BTW you can add or modify properties using Image.SetPropertyItem().
Regards,
|
|
|
|
|
|
Use:
File.GetCreationTime and store it in a file ( .xml, .txt, .dat...e.t.c )
Hope this helps...
|
|
|
|
|
Read Luc's comments they are insitefull!
|
|
|
|
|
hi..
i have built up a window based software ...with vb.net....i want the software to be installed in any machine....with setup.exe...the datasource is now required to be changed the user from .exe.config file...but how can the software retrieve machine's servername and change the datasource to the machine's servername...
thanks
|
|
|
|
|
System.Environment.MachineName will return the current machine's netbios name.
System.Environment.GetEnvironmentVariable("COMPUTERNAME") will return the computer name
|
|
|
|
|
Hi,
I am new in Communicator Web Access. Can you please provide me some sample using Communicator Web Access?
I tried to connect Communicator Web Access server. My main problem is that how can i get event when any body comes online? I want to develop web application using ASP.Net and C#. Can you please tell me, how browser is refreshed when any body comes online?
Thanks,
Regards,
Hardik Patel
Analyst Programmer
|
|
|
|
|
i want to insert unicode(arabic,urdu) characters from c# to SQL server 2005. but sql is not supporting the unicodes.
|
|
|
|
|
rehab1 wrote: but sql is not supporting the unicodes.
it does.. change datatype to unicode by adding 'n' in front of type name ex. 'nchar', 'nvarchar'..
life is study!!!
|
|
|
|