|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
My.Settings object set setting by name?I have a situation where I know the name of the setting, and want to pass it into a function, and set or get the corresponding setting. The following is find, but a pain if you have lots of settings to do in one go... My.Setting.Dachshund=1000 Dim theSetting As Integer=My.Setting.Dachshund Looking for some thing like... Sub SetSetting(ByVal theName As String, ByVal theValue As Object) My.Setting(theName) = theValue End Sub Function GetSetting(ByVal theName As String) As Object Return (My.Settings(theName)) End Function I figure i could call My.Setting.<Method>? Via Invoke by name? But I am not a Invoke guru? Any help greatly desired, Thanks On 2006-05-06, Dachshund Digital <Schors***@adelphia.net> wrote:
Show quoteHide quote > I know there must be a way to do this... in .NET 2.0? This is evil, but you could always do something like> > I have a situation where I know the name of the setting, and want to > pass it into a function, and set or get the corresponding setting. > > The following is find, but a pain if you have lots of settings to do in > one go... > > My.Setting.Dachshund=1000 > Dim theSetting As Integer=My.Setting.Dachshund > > Looking for some thing like... > > Sub SetSetting(ByVal theName As String, ByVal theValue As Object) > > My.Setting(theName) = theValue My.MySettingsProperty.Settings.Item(theName) = value Rather than using undocumented names though, you'd probably be better off saving a hashtable or NameValueCollection in My.Settings, then accessing its members normally. Show quoteHide quote > > End Sub > > Function GetSetting(ByVal theName As String) As Object > > Return (My.Settings(theName)) > > End Function > > I figure i could call My.Setting.<Method>? Via Invoke by name? But I > am not a Invoke guru? > > Any help greatly desired, Thanks >
Read Emails on Exchange server without OL client
single to string problem Simple TCP communications examples Error setting CSV to display text Thread terminating instantly How to move the mouse around in vb.net Invalid format of DLL How do I take a screenshot in VB.net 2005 Move emails (.msg files) between an Outlook inbox and a file direc How to simulate mouse click in vb.net |
|||||||||||||||||||||||