|
(Btw, I'm a bit surprised by the fact that there is no simple "wrapper" for saving/reading data from xml-files, something like TIniFile in Delphi. I've experimented a bit with "Applications settings" which seems really great, but I would like to have mote control of how the xml-file looks, where it is placed, etc.)
Please don't let this rant overshadow my original question.
Thanks again!
Daniel
|
|
|
|
|
DanielCrk wrote: I'm a bit surprised by the fact that there is no simple "wrapper" for saving/reading data from xml-files
You should be, as your gut is right - the wrapper is called XmlSerializer[^]. Simply wrap it in a method and use it to go from object->XML and back. Also works on collections
DanielCrk wrote: something like TIniFile in Delphi
Prefer XML, as it has better support for handling data and validation.
DanielCrk wrote: I would like to have mote control of how the xml-file looks, where it is placed
Serialize to a MemoryStream, not to a FileStream; you'll be able to manipulate it all you like, before saving the string to a file.
Bastard Programmer from Hell
|
|
|
|
|
Thanks Eddy, I'll definitely check that out. I finally figured out how to include and use "external" classes (alot thanks to jschell) and tried out the one I referred to in my original post, and it seems to be working exactly how I was hoping. So I'll compare the two and see what fits me the best.
I really appreciate your input, and it looks I'll be visiting this forum again! =)
/Daniel
|
|
|
|
|
DanielCrk wrote: Thanks
You're welcome
DanielCrk wrote: it looks I'll be visiting this forum again! =)
Yeah, me too
Bastard Programmer from Hell
|
|
|
|
|
In visual studio you would be working in a solution.
A solution can have one or more projects in it.
A project, in the Explorer view (think that is what is called) each project has 'References' under it.
You can add a dll to 'References.'
As for the xml files there could be many places to put them. But you could
1. Put them in the root where your .cs files are.
2. Add them to the project via right click and add existing.
3. Right click each xml file, select properties and then under 'Copy to Output...' make a selection.
|
|
|
|
|
Got it working, thanks alot!
/Daniel
|
|
|
|
|
I have a C#.net 2008 desktop application that uses some third party software. Since the third party software venfor went out of, I can not ask them any questions about their code. Due to this fact, I have the following questions:
1. I know these third party components had to of been added as a reference. However, can you tell me if there is a way to tell how these third party components were added to the application? For example, could these components have been added as COM, .net components, and/or browse to a location?
2. If I want to remove any of these third party components from this visual studio 2008 C# desktop application, can you tell me how I wouldremove these items?
|
|
|
|
|
1. It's not very easy to see how they were added, but if you check the properties of the Reference entries within your project then that should give some information about their location.
2. You need to decide first what will happen in your application if you remove them; will it still run or crash?
|
|
|
|
|
C# references additional items:
1. I looked at the properties for each third party component and found all 6 items are file type 'assembly'. Is there any way for me to tell if they were an added reference to the solution as a '.net', COM, proejct, or browse items?
2. If there any way to tell if these third party items are required or not? The only thing I can think to do is just remove one item at a time and see if the application still is running.
|
|
|
|
|
Absolutely. Assembly means they're .NET. Remove them, and if they're needed its very likely that you'll end up with compile errors. The exception to this is if they are dynamically created at runtime which is pretty unlikely, but delete everything in your bin folder to make sure.
Regards,
Rob Philpott.
|
|
|
|
|
If this code is .net, is there any way I can tell where all the code acutally exists?
|
|
|
|
|
1. I'm not really sure why this is important.
2. If you remove them then the chances are that your application will not even build. You should find out why these are included in your application before taking any action.
|
|
|
|
|
The only way i would determine why they exist, by the code that calls it and the results returned by the code, correct?
|
|
|
|
|
Exactly so, and one would hope the original writer(s) put in sufficient documentation to explain what it's there for.
|
|
|
|
|
I'm trying to build an application that need to show web pages in a Forms.WebBrowser relatively fast. My question is if anybody knows how I can pre-cache webpages? One solution would be to accept a slower load time the first time the page is shown, but is there a way to avoid even that?
|
|
|
|
|
Assuming you can predict the pages of interest, you could have one or a few threads fetching those pages (using either WebClient or HttpWebRequest), then stuff the required one in WebBrowser.DocumentText; however the net result might be less than you'd hope for, as nowadays web pages often require additional loads (such as javascript files, CSS files, images, etc), and, unless you parse the page document yourself, those would not be fetched simply by instructing WebClient/HttpWebRequest to load the main pages.
Another approach could be to have a number of WebBrowser controls, not necessarily present and visible (to be checked!) on one of your Forms; and use their Navigate() method. That should go fetch the entire web page, including all dependencies, and all those files would automatically end up in the Windows caching system, so as soon as your regular WebBrowser asks for the same pages, they should come up pretty quickly.
|
|
|
|
|
Try storing your data in XML and avoid heavily loaded datasets
I only read newbie introductory dummy books.
|
|
|
|
|
Are you sure you're answering the question that was asked, and the poster who asked it?
|
|
|
|
|
Assuming that the slow speed is caused by data load.
I only read newbie introductory dummy books.
|
|
|
|
|
The OP is opening web forms in a browser window - what does this have to do with datasets or XML?
|
|
|
|
|
I think I'll try the second approach, it seems easiest and I can accept a slower start-up of the program. Thanks for the suggestion!
|
|
|
|
|
you're welcome.
|
|
|
|
|
I'm a long term C++ programmer transitioning to C# and, for my first real application, I'm using datagridview to hold a class. However, I don't want to display all the data fields on the front page. What I've done is to put some button columns on the main page and then grouped related fields in a dialog when the user presses a button. However, this creates a dilema. I want to make sure that the user enters proper data (ints, doubles, strings, etc.) in the dialog fields and I can't figure out how to do it. When I bind to the main data source the program crashes; understandable since the binding is probably broken when I go from the grid to the dialog. What I planned on doing was validating the fields in the dialog and then putting them in the data object when the user closes the dialog. In C++ you could associate text boxes with data types but I can't seem to figure out how to do this in C#. Any help would be appreciated. Thanks.
|
|
|
|
|
Look into using NumericUpDowns and DateTimePickers rather than TextBoxes for numeric and date values.
|
|
|
|
|
Since you are new to c# I would suggest that you use conversion from string to other types.
Use error catch exception to alert user to input data in good format.
I only read newbie introductory dummy books.
|
|
|
|