Click here to Skip to main content
15,887,881 members
Home / Discussions / C#
   

C#

 
GeneralStrings in C# Pin
gmhanna27-Sep-03 15:15
gmhanna27-Sep-03 15:15 
GeneralRe: Strings in C# Pin
gmhanna27-Sep-03 15:18
gmhanna27-Sep-03 15:18 
GeneralRe: Strings in C# Pin
J. Dunlap27-Sep-03 15:48
J. Dunlap27-Sep-03 15:48 
GeneralRe: Strings in C# Pin
Daniel M. Edwards27-Sep-03 18:50
Daniel M. Edwards27-Sep-03 18:50 
GeneralRe: Strings in C# Pin
Bo Hunter28-Sep-03 7:32
Bo Hunter28-Sep-03 7:32 
GeneralRe: Strings in C# Pin
Daniel M. Edwards28-Sep-03 8:23
Daniel M. Edwards28-Sep-03 8:23 
GeneralTreeview Question Pin
Shahin7727-Sep-03 11:47
Shahin7727-Sep-03 11:47 
GeneralRegistry Pin
.gonad27-Sep-03 5:49
.gonad27-Sep-03 5:49 
I have a string value in the registry that i'm trying to read into my app. I need this value to be read as an integer so i can use it in a custom function.
<br />
RegistryKey rk = Registry.Users;<br />
rk = rk.OpenSubKey(@".DEFAULT\CustomForm", false);<br />
int result = calculate(rk.GetValue("GRN1"),2);<br />
<br />
public int calculate(int x, int y)<br />
{<br />
  int result = x * y;<br />
  return result;<br />
}<br />


The rk.GetValue("GRN1") returns an Object Type, but how can i get it to return an Integer type. I get an 'Invalid Cast' error when i try to cast from a different 'domain' (as msdn calls it)....

int result = calculate((int)rk.GetValue("GRN1"),2);

so, how can i get an object value from the registry to convert to an integer?

Thanks for your help

.gonad.
GeneralRe: Registry Pin
Wjousts27-Sep-03 11:58
Wjousts27-Sep-03 11:58 
GeneralRe: Registry Pin
Daniel M. Edwards27-Sep-03 19:10
Daniel M. Edwards27-Sep-03 19:10 
Generalrtf to mark-up Pin
Anonymous27-Sep-03 4:25
Anonymous27-Sep-03 4:25 
GeneralRe: rtf to mark-up Pin
Anonymous27-Sep-03 4:26
Anonymous27-Sep-03 4:26 
GeneralRe: rtf to mark-up Pin
Daniel M. Edwards27-Sep-03 19:24
Daniel M. Edwards27-Sep-03 19:24 
GeneralRe: rtf to mark-up Pin
leppie28-Sep-03 1:00
leppie28-Sep-03 1:00 
GeneralRe: rtf to mark-up Pin
Daniel M. Edwards28-Sep-03 6:14
Daniel M. Edwards28-Sep-03 6:14 
Questionhow to call ShellExecute in .NET Pin
bugtwo26-Sep-03 23:35
bugtwo26-Sep-03 23:35 
AnswerRe: how to call ShellExecute in .NET Pin
Nish Nishant27-Sep-03 0:06
sitebuilderNish Nishant27-Sep-03 0:06 
GeneralRe: how to call ShellExecute in .NET Pin
bugtwo27-Sep-03 0:35
bugtwo27-Sep-03 0:35 
GeneralMulty form question Pin
Jasper4C#26-Sep-03 22:58
Jasper4C#26-Sep-03 22:58 
GeneralRe: Multy form question Pin
Saikat Sen27-Sep-03 12:21
Saikat Sen27-Sep-03 12:21 
GeneralRe: Multy form question Pin
I G 19827-Sep-03 19:17
I G 19827-Sep-03 19:17 
GeneralRe: Multy form question Pin
Jasper4C#27-Sep-03 23:16
Jasper4C#27-Sep-03 23:16 
GeneralRe: Multy form question Pin
I G 19828-Sep-03 2:34
I G 19828-Sep-03 2:34 
GeneralRe: Multy form question Pin
Jasper4C#28-Sep-03 5:13
Jasper4C#28-Sep-03 5:13 
GeneralRe: Multy form question Pin
I G 19828-Sep-03 19:57
I G 19828-Sep-03 19:57 

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.