Cross-thread operation not valid: Control 'ddlCountry'

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Cross-thread operation not valid: Control ddlCountry accessed from a thread other than the thread it was created on.
I get this error when trying to set the below string. <font size=2>
strSendData = </font><font color="#800000" size=2>"RGSTR"</font><font size=2>
+ txtUserName.Text
+ </font><font color="#800000" size=2>"|"</font><font size=2> + txtPassword.Text
+ </font><font color="#800000" size=2>"|"</font><font size=2> + txtEmail.Text
+ </font><font color="#800000" size=2>"|"</font><font size=2> + txtFName.Text
+ </font><font color="#800000" size=2>"|"</font><font size=2> + txtLName.Text
+ </font><font color="#800000" size=2>"|"</font><font size=2> + ddlCountry.SelectedValue
+ </font><font color="#800000" size=2>"|"</font><font size=2> + ddlState.SelectedValue;</font>
<font size=2>ddlState does the same thing. All I am trying to do is get the value, I am not trying to set ddlCountry or State to anything. The only examples online are ways of setting the ddls not getting thier values. Any why would I have a problem with just the ddls and not the Textboxes also in the string.</font>
<font size=2>Thanks </font>

View the full article
 
Back
Top