| re: ComboBox - Setting the SelectedIndex - Throwing an error
Hi John,
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?
Rgds,
Phil
<john.halet@usa.net> wrote in message
news:1123528929.272781.205140@o13g2000cwo.googlegr oups.com...[color=blue]
> This line of code had been working with out issue, now its throwing
> errors.
>
> In my case I have three items in the ComboBox. If I try to change the
> selected index it throw the error.
>
> Earler in the code I check to see if the combobox has any items, if so
> then I set it to 0 with out issue.
>
> Then a bit later in the code I try to set it to the last server used.
>
> cboServer.SelectedIndex = cboServer.FindString(sServerName)
>
> I try in in the command window and get the same results.
> cboServer.SelectedIndex = 1
>
> Throws this Error:
>
> Run-time exception thrown : System.ArgumentException - Could not bind
> to the new display member.
> Parameter name: newDisplayMember
>
> I've seen several postings about this error message but none have
> anyting to do with the SelectedIndex.
>
> Does anyone have any ideas as to what may be happening?
> Any thoughts, ideas would be appreciated.
>[/color] |