Hello,
In regards to the Registry...
Can someone give me an example of how to list an unknown number of subkeys
under a key, and put the key names in one column of a listbox, and the key
values in another column of a listbox?
Thanks! 3 4296
"vbMark" <no@email.com > wrote in message
news:Xn******** *************** *@130.133.1.4.. . Hello,
In regards to the Registry...
Can someone give me an example of how to list an unknown number of subkeys under a key, and put the key names in one column of a listbox, and the key values in another column of a listbox?
Thanks!
Look at GetSubKeyNames( ), and GetValueNames of the RegistryKey object.
HTH,
Eric
"Eric Eggermann" <<none>> wrote in
news:#s******** ******@TK2MSFTN GP11.phx.gbl: "vbMark" <no@email.com > wrote in message news:Xn******** *************** *@130.133.1.4.. . Hello,
In regards to the Registry...
Can someone give me an example of how to list an unknown number of subkeys under a key, and put the key names in one column of a listbox, and the key values in another column of a listbox?
Thanks!
Look at GetSubKeyNames( ), and GetValueNames of the RegistryKey object.
HTH, Eric
I know this isn't right but I know I'm close.
What do I need to do to fix this?
string[] strKeys;
string[] strValues;
RegistryKey rk = Registry.Curren tUser;
rk = rk.OpenSubKey(" Software\\Micro soft\\Windows\\ CurrentVersion
\\Internet Settings");
strKeys = rk.GetSubKeyNam es();
for (int i = 0; i < strKeys.Length; i++)
rk = strKeys.GetValu e(i);
listBox.Items.A dd(rk.GetValueN ames);
"vbMark" <no@email.com > wrote in message
news:Xn******** *************** *@130.133.1.4.. . I know this isn't right but I know I'm close. What do I need to do to fix this?
string[] strKeys; string[] strValues; RegistryKey rk = Registry.Curren tUser; rk = rk.OpenSubKey(" Software\\Micro soft\\Windows\\ CurrentVersion \\Internet Settings"); strKeys = rk.GetSubKeyNam es(); for (int i = 0; i < strKeys.Length; i++) rk = strKeys.GetValu e(i); listBox.Items.A dd(rk.GetValueN ames);
You are getting closer. One thing is, I'm not really sure what you're trying
to show to the user, so it's hard to be more helpful. But for starters, you
should understand that a key can hold subkeys, which can hold subkeys, etc,
etc; which at the bottom hold name value pairs. So not all keys will have a
single value which means anything if you can figure out a way to display it
in one line of a list box. In other words the depth of the registry is
unknown (at least to me.)
Now, your last try in code. You wrote RegistryKey rk = Registry.Curren tUser; rk = rk.OpenSubKey(" Software\\Micro soft\\Windows\\ CurrentVersion \\Internet Settings");
You're setting rk twice in two lines. Not necessary. (watch word wrap)
RegistryKey rk =
Registry.Curren tUser.OpenSubKe y(@"Software\\M icrosoft\\Windo ws\\CurrentVers i
on\\Internet Settings");
Console.WriteLi ne("Subkeys: " + rk.SubKeyCount) ; // = 10 on my machine
Console.WriteLi ne("Values: " + rk.ValueCount); //= 30 on my machine
then you have strKeys = rk.GetSubKeyNam es();
which returns all the subkeys which are like folders, and which may be what
you want, but I'm not sure. The names you get are other keys, which can
contain values and other keys. So I'm not sure what you get with the for
loop but it's probably not what you want.
On my machine, the key you open has ten subkeys, and 30 values, which are
different. The subkeys are like subfolders, and the values like files.
Once you figure out which it is you want, the subkeys or the values for a
key, you can load the list box using just two lines like
string[] keys = rs.GetSubKeyNam es();
listBox1.DataSo urce = keys;
HTH
Eric This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: vbMark |
last post by:
Here's my code:
string strKeys;
RegistryKey rk = Registry.CurrentUser;
RegistryKey val = Registry.CurrentUser;
string sLocation = "Software\\Microsoft\\Windows\\CurrentVersion
\\Internet Settings\\P3P\\History";
rk = rk.OpenSubKey(sLocation);
strKeys = rk.GetSubKeyNames();
for (int i = 0; i < strKeys.Length; i++)
|
by: Allen |
last post by:
Hey all, I have a question for you all. I'm learning vb.net and need some
help. I have two classes one named Customers and one named CustomersDA. I
have to go though Customer for everything. I have a listbox that needs to
get data from an array. I call a function called GetAll that is a ArrayList
in Customers that then calls CustomersDA.GetAll that is also an array list
but returns customers (see code below).I need to fill a listbox from...
|
by: Allen |
last post by:
I have a class that returns an arraylist. How do I fill a list box from what
is returned? It returns customers which is a arraylist but I cant seem to
get the stuff to fill a list box. I just learning and really need some help
bad.
Public Shared Function GetAll() As ArrayList
Dim dsCustomer As New DataSet()
Dim sqlQuery As String = "SELECT Name, Address, PhoneNo " & _
"FROM CustomerTable"
Try
|
by: Jonny |
last post by:
Hi All
I am writing a small app that enumerates a certain registry key & then adds
the key values to a listbox
When I select one in the listbox & click the delete button I want to delete
that item from the registry
Example:
|
by: JOSII |
last post by:
Getting a string of boolean value into and out of the registry is no problem.
Here's the problem:
Although you can place an object into the registry and retreive it, I need
to place an ArrayList object with 10 string items into the registry and
retreive them later. I tried this:
key.SetValue("lstNSXitems", lstNSX.Items)
where "lstNSXitems" is the name of the subkey, and lstNSX.Items is the
| |
by: raypjr |
last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the particular elements in the List Box. Any suggestions on how to best write this?
' I create a Structure with members
' place, title, author, publisher, price, description, lastweek, weeksonlist
Structure bestseller
Public place...
|
by: raypjr |
last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the particular elements in the List Box. Any suggestions on how to best write this?
' I create a Structure with members
' place, title, author, publisher, price, description, lastweek, weeksonlist
Structure bestseller
Public place As Integer...
|
by: registry |
last post by:
<%@Language="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Registry Network Hospital Detail</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
|
by: angelicdevil |
last post by:
i have 2 tables 1 is status_type with field name status and other is users with field username and status
now i want that the first listbox lists all status from status type ( this i have achieved with php )
and based on selection of the value in listbox 1 the corresponding data in table users be loaded in listbox 2 .
i have achieved this by using a button in php but i want tht it operate without submit button and no page refreshing
...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |