Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2008 > Visual Basic 2008 Essentials
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 21st, 2008, 03:07 PM
Registered User
 
Join Date: May 2005
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default Using My.Settings with a variable

I am currently using My.Settings properties to save user generated settings for button controls. However, with 20 buttons per form, I'm writing a lot of code. Is there a way to pass a My.Settings property name as a variable and have it read by a method? For example:

Code:
Public Sub GetInput (ByVal propertyName As String)
 
  My.Settings.[propertyName] = someValue
 
End Sub
 
Old December 24th, 2008, 12:01 PM
Registered User
 
Join Date: May 2005
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Well, I finally found the solution. I feel kind of stupid now as well. The way to do it is:

Code:
Public Sub GetInput (ByVal propertyName As String)
 
  My.Settings.Item(propertyName) = someValue
 
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Language settings jemacc Reporting Services 0 June 4th, 2008 03:35 PM
Changing Settings.settings when assembly is in GAC evandro.paula .NET Framework 2.0 0 September 25th, 2007 09:54 AM
Printer Settings melvik C# 0 May 25th, 2004 02:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.