Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

Posted

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

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
Posted

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?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
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

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

  • 2 weeks later...
Posted

Thank You.

 

Have you tried using

System.IO.Path.GetFileNameWithoutExtension(Application.ExecutablePath)

 

 

Thanks PlausiblyDamp This worked Great!!

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...