Hey guys / gals. I'm having a little trouble figuring out how to bypass the first form of my program based on the content of a My.Settings... setting.
Details
When the program loads it shows a form that allows you to select the network adapter you wish to monitor.
When you have selected the adapter you click a button (Save), which shows Form1 (main form) and saves the settings.
When Form1 loads it closes NICselect then reloads the settings.
txtAdapters.Text is the property I wish to check.
Problem
The issue is that it gets annoying having to reselect the adapter each time the program is launched, so I wish to check the My.Settings property of a control on NICselect which holds the last selected adapter. I have tried a few times, but I'm still getting the NICselect form on each launch.
Current code
NICselect load:
Save command for NICselect:Code:'Form Load Private Sub NICselect_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load 'Need to add My.Settings check to see if the adapter matches the My.Settings setting. If so, skip this form and open Form1. 'Otherwise, start with this form. If My.Settings.txtAdapters <> Nothing Then Form1.Show() Me.Close() Else Me.Show() End If
Form1 loadCode:'Save, open Form1, close this form Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click Form1.Show() My.Settings.Save() perfErrorCatcher.Dispose() End Sub
Code:Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load perfNetDown.InstanceName = NICselect.txtAdapters.Text.Replace("/", "_") perfNetUp.InstanceName = NICselect.txtAdapters.Text.Replace("/", "_") NICselect.Close() My.Settings.Reload()
Any and all help contributed would be greatly appreciated. =)




Reply With Quote
