|
Take a look at the XmlSerializer class[^].
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
I really like this XML serializer concept.
Have not seen any examples for serializing an ArrayList.
Can you guide me to any?
|
|
|
|
|
The MSDN topic of the XmlSerializer class contains an example.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
You can use binary serialization too. It is faster but the output file is not human readable
|
|
|
|
|
Are you using .net 2.0? If you are you can use a generic List of Int or of an object. Then you can use the xmlserializer to transform the generic list to an xml string. This string can be saved to a file and then read again later. The biggest issue with serialization is that if you change your object you need to make sure you handle that if you are reading an old file that doesn't have new fields etc. If you are just saving a list of numbers then you probably won't have an issue.
Ben
|
|
|
|
|
If you write Write(AList) then it will be the same as Write(AList.ToString()) I don't think you need this do you? So iterate over the arraylist and write its elements in a way in which you need them
|
|
|
|
|
Thanks, i will step through each one
|
|
|
|
|
Hello,
Is there a way to set the background color for a MenuItem without using p/invoke?
Thanks in advance.
Standards are great! Everybody should have one!
|
|
|
|
|
Overriding the DrawItem or Paint method?
|
|
|
|
|
I've tried to but that doesn't work. DrawItem and Paint never get called. Hooking up to the drawitem event from the constructor doesn't help either, since the event never seems to fire. I suspect the control gets painted by its parent container...
Standards are great! Everybody should have one!
|
|
|
|
|
hi all,
I am using a windows application to create a reminder. I am using Ms Access as my backend.I need a help in a query in access.
i need to check the time values in access.For eg,i need to fetch the records which satisfy the following
select * from events where event_time=12:24 AM
Can anyone help me with a query in access(the query i tried in sql is not working for access)? The query should check for both hour and minutes
Thanks in advance
Regards
Anuradha
|
|
|
|
|
Dear
First the field "event_time" must be of data type "Date/Time" (This must be set within the Access Table "events")
Then, you shoul dnote that the Date/Time data types are dealt with differently
the statement will be somthing like this
SELECT * FROM events
WHERE evet_time = #12:24 AM#
Regards
GoudaSharp
Mohamed Gouda
Developer
|
|
|
|
|
hello,
I have a pci card and i have the path of the port in a string value (//.////)
in the write file func the value "hport" is in intptr;
1) I would happy if someone give an example of using in the fnction WriteFile
2) how I convert STRING TO INTPTR
|
|
|
|
|
Hi,
this is an example that writes a text string to a pipe using WriteFile.
For P/Invoke you can have several prototypes with different sets of arguments;
there is no need to convert to IntPtr yourself.
BTW if you provide a string or StringBuilder it will convert Unicode to 8-bit ASCII
by default.
private void SendString(StringBuilder sb) {
IntPtr pipe2=CreateFile(pipeName, GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
Thread.Sleep(200);
int count;
bool OK=WriteFile(pipe2, sb, sb.Length, out count, 0);
if (!OK) ... report error
ClosePipe(pipe2);
}
[DllImport("kernel32.dll", SetLastError=true)]
public static extern bool WriteFile(
IntPtr hHandle,
StringBuilder lpBuffer,
int nNumberOfBytesToWrite,
out int lpNumberOfBytesWritten,
uint lpOverlapped
);
|
|
|
|
|
I Have a web service listner. Another web service calls a function , say...
Myfunc. I return success when i am done and the process starts again.
i would like to track some data when Myfunc is called that i can use for validation on subsequent calls to Myfunc. Using memory will not work because if i store some data on call 1 to Myfunc, in an array list, on the subsequent call to Myfunc, that data is gone.
What is the quickest, way to get around this?
Is it Threads? If so, can someone give me some guidance on threads in C#
Or is it simply to write to a file before i return success, then read from the file when Myfunc gets called again. In that way, i always have current data?
|
|
|
|
|
Define the array list as "public shared", I think it not clear when subsequent call.
|
|
|
|
|
So public shared, keeps the memory and will not loose it on subsequent calls?
Remember the web service is like a dll.
Are you sure this would work?
|
|
|
|
|
|
public shared is a VB concept.. Does not work in C#
|
|
|
|
|
If u convert "Public Shared ABC As String()"code of vb to C# will find this "public static string[] ABC;" so test this one working for u.
|
|
|
|
|
Hi all,
I'm using the standard open file dialog of windows in my c# application. The problem is, I want the dialog to show a thumbnail preview of the html files of the current directory . How can I do that?
thanking you in advance,
jaz
|
|
|
|
|
|
Hi Giorgi Dalakishvili,
Thanks for your reply..
but i am looking for an template browser that shows thumbnails of templates (saved as html files not images)... do u have any other solutions.
Thanks once again
jaz
|
|
|
|
|
But you will definitely need openfiledialog with picturebox won't you? You now to find out how to get thumbnail from website. Google is your friend
|
|
|
|
|
hi,
thanks,
u r correct , i need openfiledialog with picturebox...
but without getting thumbnail from a html file my idea will not work...
I tried google.. and i got openfiledialog with picturebox but not a single example or idea about getting the thumbnail view of a html file..
Can u giv me someidea ????????
Thanks;)
jaz
|
|
|
|