arlanne2 Posted September 29, 2011 Share Posted September 29, 2011 Hi to all i need help how to fix this error (InvalidArgument=Value of '0' is not valid for 'SelectedIndex'.Parameter name: SelectedIndex) this a mac changer code. thanks for any help.Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim networkcard As RegistryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}") Try 'Get all the network cards names and add it to Combo Box For Each netcard In networkcard.GetSubKeyNames Dim networkcard2 As RegistryKey = Registry.LocalMachine.OpenSubKey("SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\" & netcard, False, Security.AccessControl.RegistryRights.ReadKey) Dim networkcardname As String = networkcard2.GetValue("DriverDesc") ComboBox2.Items.Add(netcard) ComboBox1.Items.Add(networkcardname) networkcard2.Close() Next networkcard.Close() ComboBox1.SelectedIndex = 0 Catch ex As Exception networkcard.Close() ComboBox1.SelectedIndex = 0 End Try End Sub Link to comment Share on other sites More sharing options...
Recommended Posts