I'm not sure that I can answer your question without a little more
understanding of what is going on. One thing that immediately puzzles me is
your comment about setting the selectedindex directly from the IDE. Unless
you have somehow cleared your itemlist or you only have one item (zero based
index) I don't see the problem with this statement.
Have you tried cboServer.FindString(Trim(sServerName))
Have you tried returning some properties of the cbo immediately before
setting the SelectedIndex?
I have tried returning some properties from the combo box.
I put a break point in the code (on the line of code below) and printed
out a few items such as items.count etc... in the command window.
cboServer.SelectedIndex = cboServer.FindString(sServerName)
I have tried finding the server names in the combo box.
? cboServer.FindString("ServerOne")
Return 0
? cboServer.FindString("ServerTwo")
Returns 1
? cboServer.FindString("ServerThree")
Returns 2
When I set index I get the error
cboServer.SelectedIndex = 1
The combo box is loaded with the informaiton I want.
When I try to set the index of the combobox I get that error.
If I comment out the "cboServer.SelectedIndex =
cboServer.FindString(sServerName)" the applicaiton runs and you are
able to use the combo box.
Its very strange... Yesterday I was using the application and it
worked fine. I came back a few minutes later to use that application
and found that was throwing erros when it loaded?
I checked out the source code and begain testing and found that it was
complaining about setting the Selected Index?
This should work...
I tried setting the index to something that was not valid for the list.
cboServer.SelectedIndex = 23
I got the expected message complaining about an invalid index value.
I have tried returning some properties from the combo box.
I put a break point in the code (on the line of code below) and printed
out a few items such as items.count etc... in the command window.
cboServer.SelectedIndex = cboServer.FindString(sServerName)
I have tried finding the server names in the combo box.
? cboServer.FindString("ServerOne")
Return 0
? cboServer.FindString("ServerTwo")
Returns 1
? cboServer.FindString("ServerThree")
Returns 2
When I set index I get the error
cboServer.SelectedIndex = 1
The combo box is loaded with the informaiton I want.
When I try to set the index of the combobox I get that error.
If I comment out the "cboServer.SelectedIndex =
cboServer.FindString(sServerName)" the applicaiton runs and you are
able to use the combo box.
Its very strange... Yesterday I was using the application and it
worked fine. I came back a few minutes later to use that application
and found that was throwing erros when it loaded?
I checked out the source code and begain testing and found that it was
complaining about setting the Selected Index?
This should work...
I tried setting the index to something that was not valid for the list.
cboServer.SelectedIndex = 23
I got the expected message complaining about an invalid index value.
Where are you setting this and is there more code around.
By instance setting the selected index inside the selected index change
event, gives mostly a lot of trouble if there is not a protection that the
set itself throws an selected index change event.