Click here to Skip to main content
15,896,111 members
Home / Discussions / C#
   

C#

 
Generaldrawing on the main menu background Pin
jcl55522-Oct-04 9:44
jcl55522-Oct-04 9:44 
GeneralRe: how to open url and login Pin
Heath Stewart22-Oct-04 12:45
protectorHeath Stewart22-Oct-04 12:45 
GeneralSerializing an object with two events; need to store the hooked-up event handlers somehow Pin
PilsnerDk22-Oct-04 8:32
PilsnerDk22-Oct-04 8:32 
QuestionRegOpenKey and similar .... marshal/P-Invoke?? Pin
Paolo Ponzano22-Oct-04 7:56
Paolo Ponzano22-Oct-04 7:56 
AnswerRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Nick Parker22-Oct-04 10:57
protectorNick Parker22-Oct-04 10:57 
AnswerRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Ami Bar22-Oct-04 13:56
Ami Bar22-Oct-04 13:56 
GeneralRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Paolo Ponzano23-Oct-04 1:35
Paolo Ponzano23-Oct-04 1:35 
GeneralRe: RegOpenKey and similar .... marshal/P-Invoke?? Pin
Ami Bar23-Oct-04 5:01
Ami Bar23-Oct-04 5:01 
I wrote a simple window application that fills a treeview with registry keys.
The code fills the tree with the registry keys (no values)

private void FillNode(TreeView treeView, TreeNode parentNode, RegistryKey key)
{
    int index = key.Name.LastIndexOf("\\");
    string keyname = key.Name;
    if (index > 0)
    {
        keyname = key.Name.Remove(0, index + 1);
    }

    TreeNode node = null;

    if (null == parentNode)
    {
        node = treeView.Nodes.Add(keyname);
    }
    else
    {
        node = parentNode.Nodes.Add(keyname);
    }
    string[] subkeyNames = key.GetSubKeyNames();
    RegistryKey subkey = null;
    foreach (string subkeyName in subkeyNames)
    {
        try
        {
            subkey = key.OpenSubKey(subkeyName);
        }
        catch (SecurityException e)
        {
            // Ignore keys that we don't have security to read them
            continue;
        }

        FillNode(treeView, node, subkey);
        subkey.Close();
    }
}


To use it call:
FillNode(treeView1, null, Microsoft.Win32.Registry.CurrentUser);
Where treeView1 is your TreeView control.

Notes:
1. If you read the keys them use OpenSubKey and not CreateSubKey
2. Make sure you catch exception. There are keys you cannot open.
3. Don't forget to close keys that you open.

Good luck,
Ami
Generalfind the contents of a cell in a datagrid row Pin
steve_rm22-Oct-04 6:09
steve_rm22-Oct-04 6:09 
GeneralRe: find the contents of a cell in a datagrid row Pin
Heath Stewart22-Oct-04 12:59
protectorHeath Stewart22-Oct-04 12:59 
GeneralEfficient implementation of multidimensional arrays Pin
Andrew Kuklin22-Oct-04 5:03
sussAndrew Kuklin22-Oct-04 5:03 
GeneralRe: Efficient implementation of multidimensional arrays Pin
J4amieC22-Oct-04 5:24
J4amieC22-Oct-04 5:24 
GeneralRe: Efficient implementation of multidimensional arrays Pin
Utwig26-Oct-04 0:29
Utwig26-Oct-04 0:29 
QuestionWhich is faster?? Pin
exhaulted22-Oct-04 4:46
exhaulted22-Oct-04 4:46 
AnswerRe: Which is faster?? Pin
J4amieC22-Oct-04 5:16
J4amieC22-Oct-04 5:16 
GeneralRe: Which is faster?? Pin
exhaulted22-Oct-04 5:25
exhaulted22-Oct-04 5:25 
GeneralRe: Which is faster?? Pin
Colin Angus Mackay22-Oct-04 13:59
Colin Angus Mackay22-Oct-04 13:59 
GeneralRe: Which is faster?? Pin
exhaulted24-Oct-04 21:49
exhaulted24-Oct-04 21:49 
AnswerRe: Which is faster?? Pin
yoaz22-Oct-04 7:34
yoaz22-Oct-04 7:34 
AnswerRe: Which is faster?? Pin
Jankinsoo22-Oct-04 19:01
Jankinsoo22-Oct-04 19:01 
GeneralMFC/C++ app can't acquire C# mutex Pin
sjhart22-Oct-04 0:44
sjhart22-Oct-04 0:44 
GeneralRe: MFC/C++ app can't acquire C# mutex Pin
Uwe Keim23-Oct-04 4:49
sitebuilderUwe Keim23-Oct-04 4:49 
Generalhook 2 forms Pin
StateOfTrance21-Oct-04 22:54
StateOfTrance21-Oct-04 22:54 
GeneralRe: hook 2 forms Pin
Alex Korchemniy22-Oct-04 18:49
Alex Korchemniy22-Oct-04 18:49 
GeneralEvents in DataGrid Pin
Anonymous21-Oct-04 21:12
Anonymous21-Oct-04 21:12 

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.