How can i do a for loop with vb.net's my.settings name and value? -


i this, have tried searching on google , have tried searching here no luck.

what have tried far following:-

for each value configuration.settingspropertyvalue in my.settings.propertyvalues      dim myrecord string = my.settings.propertyvalues.tostring      sql_all_matching_records = string.format("")  next 

enter image description here gets skipped when run in debugger mode , have put break point within loop.

what want able loop through variable names in my.settings , take value , compare sql lookup. thing struggling looping through my.settings.

edit1: above has been answered, getting error in picture, have wrote code wrong? not sure understand vb.net trying tell me. thought correct.

a bit of disclaimer, i'm not familiar how/when settings loaded , propertyvalues collection gets filled, doesn't seem hold until settings value accessed. it's wierd workaround, grabbing value settings before looping through collection seems fill it. invalidcast exception occurs because you're trying set myrecord = collection.tostring. know collection has multiple values because we're iterating them, can't call .tostring on it. that's saying array.tostring(), doesn't work way. think you're looking value.propertyvalue.tostring, hold settings value you're trying get. both changes applied, this:

    dim dummy string = my.settings.dummysetting     each value system.configuration.settingspropertyvalue in my.settings.propertyvalues          'dim myrecord string = my.settings.propertyvalues.tostring         dim myrecord string = value.propertyvalue.tostring          sql_all_matching_records = string.format("")     next 

the dummysetting empty value put in settings call on. hope helps


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -