ZeroEffect Posted October 28, 2005 Posted October 28, 2005 I know how to save settings to the registry, but what I want do is save it to a location based on the name my programs name. So if I have more than two instancies running pro1.exe and pro2.exe the settings would be saved to pro1 and pro2 so there wouldn't be any conflicts. I know it is a lame question but the thoughs I have come up with have two many holes. Thanks for any thought you may have. Zeroeffect Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
Administrators PlausiblyDamp Posted October 28, 2005 Administrators Posted October 28, 2005 What code are you currently using to save to the registry? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ZeroEffect Posted October 28, 2005 Author Posted October 28, 2005 Sorry about that. Here is the code I use... SaveSetting(Application.ProductName, "Setting", "Setting Name", "Setting Value") 'I need/want "Application.ProductName" to be the name of the EXE file. 'This would allow more than one instance of the program to run 'Each with thier own settings. I could use a cfg file but I'd like to use the registry Thanks, ZeroEffect Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
Administrators PlausiblyDamp Posted October 28, 2005 Administrators Posted October 28, 2005 Have you tried using System.IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath) Is there any reason why you would prefer to use the registry bearing in mind that makes it not portable, harder to transfer and MS themselves recommend against it? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
ZeroEffect Posted October 28, 2005 Author Posted October 28, 2005 Have you tried using System.IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath) Is there any reason why you would prefer to use the registry bearing in mind that makes it not portable, harder to transfer and MS themselves recommend against it? I haven't tried that yet. I know it's not the smartest way of dealing with settings. I personally like the config class I have, but this with match the main programs way of handeling settings. I'll give your piece of code a try and see what happens. Thanks dor your help. ZeroEffect Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
ZeroEffect Posted November 10, 2005 Author Posted November 10, 2005 Thank You. Have you tried using System.IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath) Thanks PlausiblyDamp This worked Great!! Quote If you can't find it, Build It. There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10
georgepatotk Posted November 12, 2005 Posted November 12, 2005 One suggestion, you could use this code Process.GetCurrentProcess.ProcessName.ToString this code represent ur program name. Quote George C.K. Low
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.