|
As Mycroft said, it changes the extension of the path string.
To change the extension of the file, try this:
if (File.Exists(fileName))
{
string myfile= Path.ChangeExtension(fileName,".ndbm");
File.Move(fileName, myfile);
MessageBox.Show("Successfully Changed");
}
Hope this helps.
|
|
|
|
|
I have not worked with IO for so long I think I have forgotten the most interesting bits - have 5
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
you are doing it wrong you cannot do this in a string it is done only in the string..........you have to change the command such that it is not inside a variable.........maybe us this in the from load event
Path.ChangeExtension(fileName,"ndbm");
i cannot assure you that this will definitely work i only give a suggestion............although you do need to change the code such that it does not happen inside a variable...........
Regards,
Ahsan Naveed
Hope my answer satisfies you.....
|
|
|
|
|
A very bad answer, it does not address the OPs problem and is barely understandable.
Ahsan98 wrote: i cannot assure you that this will definitely work
If you don't know what you are talking about then do not participate, the OP may know even less than you do and think you have given a valid solution.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have to agree with Mycroft - if you aren't sure if something will work then test it before you offer it to the OP as a solution. That way, you either post a working solution, or you learn something. Then everybody involved gains.
Just posting stuff because "it might work" isn't what this site is about, and make it look like you just want reputation points for free. That isn't a good idea!
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre.
Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
|
|
|
|
|
I am really sorry for the mistake.............I will try my best not to do this again.......actually i am a beginner in c# and on codeproject so i did not know I am really sorry for the mistake............I was just trying fro help not doing this for points although I do admit my mistake and hope not to do it agian .......
Regards Ahsan Naveed
|
|
|
|
|
No need to apologise - just think about it from the original questioner asker's point of view: is what you are telling him useful? Or pretty much useless? If it's the latter (and yours was) then either don't post it, or try it first so you can be sure you are posting correct info.
(It's a good idea to do the latter anyway - it's far too easy to mistype something and confuse the OP even more!)
Welcome aboard! If you are a beginner in C#, it's not a bad idea to try and work out the answers you would give, but not necessarily post them. Then check the answers that were posted against what you would have written. It's surprising how much you can learn that way, and how much it improves your code as well as the question setters! It's how I started here - then when you get some confidence, post answers. Worked for me
This message is manufactured from fully recyclable noughts and ones. To recycle this message, please separate into two tidy piles, and take them to your nearest local recycling centre.
Please note that in some areas noughts are always replaced with zeros by law, and many facilities cannot recycle zeroes - in this case, please bury them in your back garden and water frequently.
|
|
|
|
|
Ahsan98 wrote: I was just trying fro help
That was obvious and the reason you were not lambasted, but you must remember that a wrong/untested answer here can misdirect someone with even less knowledge than you.
Ahsan98 wrote: actually i am a beginner in c# and on codeproject
Don't let that stop you if you are sure you know the answer then go right ahead and help.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi
i need to component that similar listview in c#, user information stored on it can be changed and re-use that information, But I would not put it in gridview because I do not need to database.
please help
|
|
|
|
|
Next time clean up your original post, don't post twice.
There is no correlation between gridview and database, the gridview does not care where the collection comes from.
What is the UI technology you are using, I suspect ASP!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
thanks
Do without use of databaseو can be used in the gridview?
How can this be done?
|
|
|
|
|
As you did not indicate which UI you are using it is a little difficult. I suggest you work through some tutorials on the tech you are attempting to work with.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i use of asp , visual stdio 2010
|
|
|
|
|
Here is some google foo[^] to help you do some research into your lack of understanding
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi All,
I am _occasionally_ (inconsistently) getting "Attempt to write to read only database" problems with System.Data.SQLite. Googling this issue brings up lots of pages talking about file/folder permission issues (especially with web servers).
I have a Windows Forms App and no web server is involved. Additionally, this problem happens inconsistently (like with every 20 Inserts) and I've got my database in %APPDATA%\MyApp folder (where %APPDATA% is set to the ...AppData\Roaming folder on my data drive). I have no reason to suspect a file/folder permissions problem.
I added a delay to each Insert and I observe that the number of, and likelihood of getting a "Attempt to write..." error is directly related to the length of the delay - a delay of 1 second after each Insert seems to *almost* completely relieve the problem.
Do I have a misconfiguration problem? Searching the net shows lots of positive comments for the stability and correctness of System.Data.SQLite and no solutions suggested except for file permissions config, but my system behaves like SQLite is tripping over itself. There are no other file operations (outside of the OS activity) happening at the same time. I'm out of ideas - help!
I'm using C# vs2008 (I think it's .net 3.5). It was a Win7 box but now it's a Win8 box (no difference for this issue).
|
|
|
|
|
A long shot; but do you have any indexes defined in there that it might try to update[^]?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thx for the reply. No, I did not explicitly add any indexes (indices?). I just did a "CREATE TABLE..." and followed it up with Inserts and Selects. The Selects work fine. The Inserts don't.
I'll take a look with that ANALYSE command that you reference.
|
|
|
|
|
OK I ran the ANALYZE statement but it doesn't show anything. Any other ideas?
|
|
|
|
|
Did you ever get to the bottom of this? I've just started seeing the same behavior on an app that has been stable for years. Really odd.
|
|
|
|
|
Does anyone know where the positions of desktop shortuts are stored? Let's say I have a desktop shortcut and I move its icon to another position on the desktop. It's position is stored somewhere because the icon is obviously restored when you reboot. I tried searching the registry for a uniquely named shortcut I added but I can't find it listed. Perhaps they're stored in a file somewhere?
Right now, this isn't a coding question as such but it may become so if the positions are strored in some arcane place that might need some equally arcane assembly to be used to get them. I figure this kind of information might need a dll import to be added? If it's easy to find I should be ok reading what I need but if it's a tricky bitch to find then, of course, a heads-up will be appreciated.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|
|
In HKCU\Software\Microsoft\Windows\Shell\Bags\1\Desktop
The format is a little arcane.
|
|
|
|
|
The data is binary and stored in HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags\1\Desktop. The position data is in the "ItemPos..." values. A binary stream is saved for each screen resolution and monitor seperately. The format of this data is not documented anywhere publicly.
The desktop icons positioning data in the running instance of Windows is managed by a ListView. No, don't even think of trying get the .NET ListView control to parse the data for you as it won't work.
The process of pulling this off is quite complicated and not well understood. You can read more about an unfinished attempt to do this here[^].
|
|
|
|
|
|
SledgeHammer01 wrote: It's not? I found it rather easily
It's been a long time since I last looked for that stuff. My definition of "documented" is a bit different than yours. I'm saying it's not "officially" documented by MS. What you linked to is a research project that attempts to reverse engineer the data.
|
|
|
|
|
Guys, I appreciate the links and information. It all seems a lot of work for what I thought was a simple thing to achieve. It seems it's anything but!
I'll mull it over and see if the effort involved is proportionate to what I wanted to do.
If there is one thing more dangerous than getting between a bear and her cubs it's getting between my wife and her chocolate.
|
|
|
|