|
There are few ways to skin this cat, in my order of preference:
- Store in a .NET Application settings file. This is pretty simple, it is useful as a dictionary and everything is done within the .net framework. Here is an MSDN entry on this[^]
- Store it in the registry: Useful where you have simple key value pairs, the value is availble to multiple applications, though you do have the worry of cleaning the key if/when the app is un-installed. Personsally I try not to use the registry (I've banged up against permissions problems in the past. See Read, write and delete from registry with C#[^] for help on how to store to the registry
- Store it in User Data folders, this is good for more complex data (which you don't have, the above two options should be sufficient) as you have more control over how to structure the data. Basically you serialize the data into the file in this folder. There is a discussion of how to save to this folder here[^], if you do go down this route you should condsider saving a config file there rather than an ad-hoc text file, it will simplify things
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
Hi, thanks for your reply. I created a temperary file where i would store the paths and when the application starts I would read the path from the file and display it in a textbox.
However, what I am missing is the highlighted folder in the FolderBrowserDialog in corrospondence to the path.
Lets say if my path is C:\Users\Public, the the folder dialog box should start from the folder Public (highlight it)
How can i do this??
|
|
|
|
|
It isn't really a temporary file, if you don't delete it when the app finished.
I understand your problem, I suggest you take a look at my first reply and use a settings file (it is the first option I gave) - it is ideal for storing single values for this, there is a link in reply. When the user opens the folder broweser it is either pre-populated with the last path you stored in the settings file or uses the default location if a value has not been stored there. When the user OKs (or whatever) the Dialog, you need to store the path from the Dialog into the settings file. That way you don't need to go through the hassle of writing the code to write/read from a raw text file.
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
|
Get your spamming out of here.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
This is actually one of the very few times I do use the registry (HKCU/Software/(your app) which you should always have full access to). This is user data, so it has to go in a user-specific data store, but not important enough to justify writing files into their user/AppData area, and it doesn't really matter if it gets lost when you copy the software to another computer. Your uninstaller should wipe the appropriate application key in the registry already.
You can store complex data in the registry, as you can put binary data in there, though you shouldn't store large objects that way. But what's asked for here is simple text variables which the registry (along with text .properties/.ini files or similar) is ideal for.
|
|
|
|
|
BobJanova wrote: This is actually one of the very few times I do use the registry (HKCU/Software/(your app) which you should always have full access to).
There may have been access problems to the area in the registry I happened to be accessing then(IIRC, when the application went live with typical flair), this isn't something I do very often. But thanks for your advice!
“Education is not the piling on of learning, information, data, facts, skills, or abilities - that's training or instruction - but is rather making visible what is hidden as a seed” “One of the greatest problems of our time is that many are schooled but few are educated”
Sir Thomas More (1478 – 1535)
|
|
|
|
|
In the CustomHeaderTest app, if I set myListView1.IncreaseHeaderHeight=20 (choose any value), it works as expected: The header is taller.
I then created a brand new Winforms app, added the CustomHeader project to it, added a MyListView to the form. Compiles & runs as expected. I then set the IncreaseHeaderHeight=20 and it does not work as expected... the header is the original height but the font in it is larger!
I've spent a bunch of time trying to figure out why the different behavior happens, but no luck.
Any ideas as to why this happens? Is it due to a project setting, or a Form setting, or what? Does anyone else see this?
|
|
|
|
|
QQ897956996 wrote: the CustomHeaderTest app Where did you get this from? If it is in a CodeProject article then you should use the forum at the end of the article to communicate with the author.
Use the best guess
|
|
|
|
|
Should I communicate with the author?
|
|
|
|
|
Well if you are using some code written by a third party, rather than part of a standard library then you have to assume that the person who wrote the code is best placed to help you.
Use the best guess
|
|
|
|
|
Hi,
I am developing a cashier POS. I would like to know how many characters to be printed on the receipt paper roll? is it standard?
www.volow.com[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
It depends on font size and type, so no, its not standard.
|
|
|
|
|
Comparing some of my own receipts they appear to be a standard 8 cm width (border 0.5 cm) & text is 7 chars per cm. These receipts have quite small font, so worst case should have fewer characters per cm than 7.
|
|
|
|
|
It depends on the device and the type of receipt. I have a bunch of receipts from credit cards and other purchases over the last month and there are at least 4 different paper widths, and 5 or 6 fonts.
Use the best guess
|
|
|
|
|
That is not depends on the number of characters, that is depends on the Papersize(width).
--RA
|
|
|
|
|
Hallo
I'm consuming a webservice returning an XML with 5 nested complexType (i.e. 5 relationed tables); I should write those data into corresponding tables in a mssql db, updating or inserting when needed.
Do DataAdapters provide such functionality?
Actually, the Update method synchronizes a dataset and its original data source. What if the dataset comes from a different datasource?
Update uses the RowState property to determine the kind of SQL command to be issued: in my case I should need something like an hash comparison (checksum) between each row in the source dataset and each row in the target db, for each table.
I'm considering to transfer to the db the whole process of hashing and comparing.
Could you give me your advice?
Thanks in advance
|
|
|
|
|
|
Your question isn't clear.
For starters the XML and web services part would seem to have little to do with it.
If you have a set of data, regardless of source, which must put into the database as one go then the normal solution is a transaction.
If there are multiple target data sources then a distributed transaction MIGHT be a choice however at least some people prefer to use a non-transactional approach in that case.
|
|
|
|
|
Schematically, I'm dealing with two datasets with the same schema: they have 5 tables.
I need to synchronize the two dataset, being Dataset A the source (XML from webservice) and Dataset B the destination (the database).
|
|
|
|
|
LordZoster wrote: I need to synchronize the two dataset, being Dataset A the source (XML from webservice) and Dataset B the destination (the database)
Yes I understand that you are starting with XML.
However that has nothing to do with writing the data in a consistent manner to he database.
If you need to read the XML data in a consistent manner than that is still a different problem UNLESS you need to provide some transaction across both sets. If so then, because the first appears to be a file, you are still going to be dealing with a transaction on the database side and for the file side there are mitigations possible but none are ideal.
|
|
|
|
|
Hello Team,
I have a jar file which has some classes.I want to access those class files from .net environment.I mean i want to pass some parameters from .net environment to class files and process the parameters in class files and send response back to .net environment.
please help me
|
|
|
|
|
|
1. Write a jave app that uses the classes and models the functionality you need.
2. Write a communications API on that using either stdio, files or sockets.
3. Use Process (or whatever it is called in .Net) to run and manage the java exe
4. Use the communications API, from 2, in your net code to talk to the executable.
Advantage to this over in process functionality is that it is easier to debug.
|
|
|
|
|
There's a very handy library, called IKVM[^], that you should really look into. It makes working with Java and .NET an absolute cinch.
|
|
|
|