| | |
vb.net 08 Reading data from multiple reg keys
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Thread Solved
![]() |
C# IS .net. It's just a C style usage of it.
EDIT: Sorry, Didn't Refresh The Page Before Posting...
vb.net Syntax (Toggle Plain Text)
Public Function GetInstalled() Dim uninstallKey As String Dim rk As RegistryKey Dim sk As RegistryKey Dim skName As String Dim sublist As New ArrayList uninstallKey = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" rk = Registry.LocalMachine.OpenSubKey(uninstallKey, True) For Each skName In rk.GetSubKeyNames() sk = rk.OpenSubKey(skName) sublist.Add(sk.GetValue("DisplayName")) Next skName Return sublist End Function
EDIT: Sorry, Didn't Refresh The Page Before Posting...
Last edited by Comatose; Jan 7th, 2009 at 10:37 am.
Try Comatose's code, and tell what you get?
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Drag a comboBox and drop it into your form
Edit Comatose's code
Edit Comatose's code
vb.net Syntax (Toggle Plain Text)
For Each skName In rk.GetSubKeyNames() sk = rk.OpenSubKey(skName) comboBox1.Items.Add(sk.GetValue("DisplayName")) Next skName
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: Mar 2008
Posts: 44
Reputation:
Solved Threads: 0
okay, but when i run the code nothing gets returned in the box.
could it be the displayname part as if you go to the registry and pick a sub key, you will see displayname. When you click on display name the key is shown but its the 2nd part under value data i need.
as if i want a particular key for the processor i use
and that returns the value data under the key
could it be the displayname part as if you go to the registry and pick a sub key, you will see displayname. When you click on display name the key is shown but its the 2nd part under value data i need.
as if i want a particular key for the processor i use
VB.NET Syntax (Toggle Plain Text)
Dim myCPUDescription As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString", "No CPU Found").ToString.Trim
and that returns the value data under the key
Last edited by smelf1; Jan 7th, 2009 at 11:57 am.
You shouldn't modify the function. The concept of a function, is that you shouldn't make them interact with the form. The idea of a function is that a function can be modular.... what if in the future, you decide to change it from a combobox, to a listbox... or save it to a file. Then you have to modify the function that actually GETS the display names of the registry keys. The purpose of a function is abstraction.... what this function does, is get the list of items in the registry (their display values) and returns them to the calling procedure. So for example, if you have a button, you would do:
It might have to be
vb.net Syntax (Toggle Plain Text)
dim something as new arraylist something = GetInstalled() for I = 0 to something.count msgbox something(i) next I
for I = 0 to something.count -1 Last edited by Comatose; Jan 7th, 2009 at 12:26 pm.
I know Comatose, but it was my last chance to get him solve his problem!!!
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Right, it returns an arraylist. So you would call it from the button, then assign the return value to an arraylist, and loop through it.
vb.net Syntax (Toggle Plain Text)
dim something as new arraylist something = GetInstalled() for I = 0 to something.count msgbox something(i) next I
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
Other Threads in the VB.NET Forum
- Previous Thread: Problem in Removing Node from XML using Vb.net
- Next Thread: retaining graphics
| Thread Tools | Search this Thread |
.net .net2005 .net2008 30minutes 2005 2008 access account arithmetic array basic browser button buttons center check code component connectionstring crystalreport cuesent data database databasesearch datagrid datagridview date datetimepicker design dissertation dissertations dissertationthesis dissertationtopic dropdownlist excel fade file-dialog filter folder ftp generatetags hardcopy image images input insert intel math monitor net networking opacity output panel passingparameters peertopeervideostreaming picturebox picturebox1 port printing problem problemwithinstallation project reports" savedialog searchvb.net select serial settings shutdown string survey tcp temperature text textbox timer timespan toolbox transparency trim updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year






