Click here to Skip to main content
15,890,609 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: AppDomain.CurrentDomain and static methods Pin
Adriaan Davel4-Jun-09 19:42
Adriaan Davel4-Jun-09 19:42 
GeneralRe: AppDomain.CurrentDomain and static methods Pin
Nicholas Butler5-Jun-09 1:50
sitebuilderNicholas Butler5-Jun-09 1:50 
QuestionHi Frnds ,,Im a beginner in website designing Pin
jeswanth_073-Jun-09 21:16
jeswanth_073-Jun-09 21:16 
AnswerRe: Hi Frnds ,,Im a beginner in website designing Pin
Pete O'Hanlon3-Jun-09 21:39
mvePete O'Hanlon3-Jun-09 21:39 
Questionerror-data reader already open Pin
manjusha s3-Jun-09 2:35
manjusha s3-Jun-09 2:35 
AnswerRe: error-data reader already open Pin
Pete O'Hanlon3-Jun-09 3:02
mvePete O'Hanlon3-Jun-09 3:02 
QuestionRegistry Hive by name? Pin
lee232-Jun-09 22:27
lee232-Jun-09 22:27 
AnswerRe: Registry Hive by name? Pin
Simon P Stevens3-Jun-09 4:27
Simon P Stevens3-Jun-09 4:27 
You're getting the exception because Registry.GetValue returns null if the key doesn't exist, and you are casting this null to a string. Instead you should check for null first.
Object keyValue = Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\MyTestApp", "InstallDir", "");
String filePath;
if(keyValue != null)
{
    // Now you know you have a value, so you can cast it to a string.
    filePath =(string)keyValue;
}
else
{
    // Do whatever you want to do if the key doesn't exist.
}


(By the way, the registry is best avoided now for most stuff. You should consider looking at .net settings or isolated storage instead unless you have to support the registry for backwards compatibility or something like that)

Simon

GeneralRe: Registry Hive by name? Pin
Not Active3-Jun-09 10:14
mentorNot Active3-Jun-09 10:14 
GeneralRe: Registry Hive by name? Pin
Simon P Stevens3-Jun-09 11:11
Simon P Stevens3-Jun-09 11:11 
GeneralRe: Registry Hive by name? Pin
lee233-Jun-09 13:27
lee233-Jun-09 13:27 
QuestionXML Serialization Problem with properties that when set change object status Pin
Sebastian Streiger2-Jun-09 2:32
Sebastian Streiger2-Jun-09 2:32 
AnswerRe: XML Serialization Problem with properties that when set change object status [modified] Pin
Moreno Airoldi3-Jun-09 1:35
Moreno Airoldi3-Jun-09 1:35 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Sebastian Streiger3-Jun-09 2:23
Sebastian Streiger3-Jun-09 2:23 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Moreno Airoldi3-Jun-09 3:03
Moreno Airoldi3-Jun-09 3:03 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Sebastian Streiger3-Jun-09 3:22
Sebastian Streiger3-Jun-09 3:22 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Moreno Airoldi3-Jun-09 22:36
Moreno Airoldi3-Jun-09 22:36 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Sebastian Streiger4-Jun-09 4:40
Sebastian Streiger4-Jun-09 4:40 
GeneralRe: XML Serialization Problem with properties that when set change object status Pin
Moreno Airoldi4-Jun-09 4:47
Moreno Airoldi4-Jun-09 4:47 
QuestionPlaying smoothly small pieces with DirectSound Pin
Andrey U2-Jun-09 0:09
Andrey U2-Jun-09 0:09 
AnswerRe: Playing smoothly small pieces with DirectSound Pin
molesworth2-Jun-09 3:31
molesworth2-Jun-09 3:31 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
Andrey U2-Jun-09 4:18
Andrey U2-Jun-09 4:18 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
molesworth2-Jun-09 6:58
molesworth2-Jun-09 6:58 
AnswerRe: Playing smoothly small pieces with DirectSound Pin
Mark Salsbery2-Jun-09 8:26
Mark Salsbery2-Jun-09 8:26 
GeneralRe: Playing smoothly small pieces with DirectSound Pin
Andrey U2-Jun-09 22:37
Andrey U2-Jun-09 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.