From: eBob.com on
When I execute the following lines of code ...

Dim clients(My.Settings.Clients.Count) As String
My.Settings.Clients.CopyTo(clients, 0)
combxClients.Items.AddRange(clients)

.... the last statement throws an exception, "Value cannot be null.
Parameter name:item". This is apparently because I have a null value in
My.Settings.Clients (Type: System.Collection / Scope: User). I think I know
how that happened and will fix the code so that it doesn't happen again.
BUT ... how do I fix the problem I have at the moment? I think that I can
simply edit the settings file but I can't find it. If it matters this is a
Vistax64 system with VS 2008.

Thanks, Bob

From: Family Tree Mike on
On 4/16/2010 9:33 PM, eBob.com wrote:
> When I execute the following lines of code ...
>
> Dim clients(My.Settings.Clients.Count) As String
> My.Settings.Clients.CopyTo(clients, 0)
> combxClients.Items.AddRange(clients)
>
> ... the last statement throws an exception, "Value cannot be null.
> Parameter name:item". This is apparently because I have a null value in
> My.Settings.Clients (Type: System.Collection / Scope: User). I think I
> know how that happened and will fix the code so that it doesn't happen
> again. BUT ... how do I fix the problem I have at the moment? I think
> that I can simply edit the settings file but I can't find it. If it
> matters this is a Vistax64 system with VS 2008.
>
> Thanks, Bob
>

This article shows you how to find it:
http://www.codeproject.com/KB/vb/appsettings2005.aspx. Hope this helps.

--
Mike
From: eBob.com on
Thank you FTM. I should have added in my original post that I tried to look
in some directories which seemed like likely candidates but ran into "Access
is denied" problems. I guess I was hoping that My.Settings lived somewhere
where I wouldn't have Access denied problems. But that is what is happening
when I try to follow the directions in the reference you gave me. And I am
logged on to an account with Admin authority and have even turned off UAC.
Well ... not a problem for this newsgroup I guess. Thanks, Bob

"Family Tree Mike" <FamilyTreeMike(a)ThisOldHouse.com> wrote in message
news:u5Hi1mi3KHA.1016(a)TK2MSFTNGP02.phx.gbl...
> On 4/16/2010 9:33 PM, eBob.com wrote:
>> When I execute the following lines of code ...
>>
>> Dim clients(My.Settings.Clients.Count) As String
>> My.Settings.Clients.CopyTo(clients, 0)
>> combxClients.Items.AddRange(clients)
>>
>> ... the last statement throws an exception, "Value cannot be null.
>> Parameter name:item". This is apparently because I have a null value in
>> My.Settings.Clients (Type: System.Collection / Scope: User). I think I
>> know how that happened and will fix the code so that it doesn't happen
>> again. BUT ... how do I fix the problem I have at the moment? I think
>> that I can simply edit the settings file but I can't find it. If it
>> matters this is a Vistax64 system with VS 2008.
>>
>> Thanks, Bob
>>
>
> This article shows you how to find it:
> http://www.codeproject.com/KB/vb/appsettings2005.aspx. Hope this helps.
>
> --
> Mike

From: James Hahn on
Write a small piece of code in startup that sets the My.Settings value to a
valid object, and saves it. Then run your app, then comment out the code.
Presumably, once your program runs the correct valid value will be written
to the variable and the problem won't recur, but for now you just need to
get something vald into teh file.

If you want to synchronise your settings you will have to find out what a
valid value is so that you can insert it as the default value for the
swetting, so even if you do edit the file, do the bit of code as above to
set a valid value into the settings and save it before you try to edit the
file - otherwise there is no simple way to work out what the edit is that
you need to do. Once you see what the required string is, insert it as the
default value.

It will be something like this:

<?xml version="1.0" encoding="utf-16"?>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>Client Option 1</string>
</ArrayOfString>

"eBob.com" <eBob.com(a)totallybogus.com> wrote in message
news:uno563c3KHA.5880(a)TK2MSFTNGP04.phx.gbl...
> When I execute the following lines of code ...
>
> Dim clients(My.Settings.Clients.Count) As String
> My.Settings.Clients.CopyTo(clients, 0)
> combxClients.Items.AddRange(clients)
>
> ... the last statement throws an exception, "Value cannot be null.
> Parameter name:item". This is apparently because I have a null value in
> My.Settings.Clients (Type: System.Collection / Scope: User). I think I
> know how that happened and will fix the code so that it doesn't happen
> again. BUT ... how do I fix the problem I have at the moment? I think
> that I can simply edit the settings file but I can't find it. If it
> matters this is a Vistax64 system with VS 2008.
>
> Thanks, Bob
>