Re: How do I access ComboBox.SelectedText from another thread?
- From: Paulers <SuperGh0d@xxxxxxxxx>
- Date: Sat, 22 Dec 2007 08:35:02 -0800 (PST)
On Dec 22, 9:31 am, Paulers <SuperG...@xxxxxxxxx> wrote:
On Dec 22, 1:23 am, Tom Shelton <tom_shel...@xxxxxxxxxxx> wrote:
Paulers wrote:
Hello all,
I have been pulling my hair out trying to figure out how to access the
selected text in a combobox from another thread. I can get it working
with a textbox but it does not with a combobox. Could someone be so
kind as to show me an example of how this is accomplished? Many thanks
in advance.
So, what are you doing with the textbox? Are you invoking a method to
return the selected text, or are you trying to access directly? Can
you be a little more specific about what doesn't work? A short code
snip-it would be helpful.
--
Tom Shelton
Thanks for the replys
in my form I am declaring:
Public Delegate Sub DelegateUIUpdate(ByVal dgv As DataGridView,
ByVal ds As DataSet)
In the Button Click I have
Dim workerThread As Thread = New Thread(AddressOf
CallsByScriptWorker)
workerThread.Start()
then I have two subs, one to do the work and the other to update the
UI thread.
Sub CallsByScriptWorker()
Dim sb As StringBuilder = New StringBuilder
sb.Append("SELECT rcd.DateTime, rcd.DialedNumberString, ")
sb.Append("rcd.TargetLabel as TargetVDN, ")
sb.Append("r.EnterpriseName as Route, ")
sb.Append("ms.EnterpriseName as Script, ")
sb.Append("rcd.FinalObjectID as Node, ")
sb.Append("rc.EnterpriseName, ")
sb.Append("rcd.ANI, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5000 THEN
ECCValue ELSE NULL END) AS CallType, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5001 THEN
ECCValue ELSE NULL END) AS ExternalID, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5002 THEN
ECCValue ELSE NULL END) AS ClientCode, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5003 THEN
ECCValue ELSE NULL END) AS FirstName, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5004 THEN
ECCValue ELSE NULL END) AS LastName, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5005 THEN
ECCValue ELSE NULL END) AS DOB, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5006 THEN
ECCValue ELSE NULL END) AS RefillComplete, ")
sb.Append("MAX(CASE WHEN ExpandedCallVariableID = 5010 THEN
ECCValue ELSE NULL END) AS RXArray ")
sb.Append("from Route_Call_Detail rcd ")
sb.Append("LEFT OUTER JOIN Route_Call_Variable rcv on
rcd.RecoveryKey = rcv.RCDRecoveryKey ")
sb.Append("LEFT OUTER JOIN Script s on s.ScriptID =
rcd.ScriptID ")
sb.Append("LEFT OUTER JOIN Master_Script ms on
ms.MasterScriptID = s.MasterScriptID ")
sb.Append("LEFT OUTER JOIN Routing_Client rc on
rcd.RoutingClientID = rc.RoutingClientID ")
sb.Append("LEFT OUTER JOIN Route r on r.RouteID = rcd.RouteID
")
sb.Append("where rcd.DateTime between '" &
Me.BeginDatePicker.Text & " " & Me.BeginTimePicker.Text & "' and '" &
Me.EndDatePicker.Text & " " & Me.EndTimePicker.Text & "' ")
sb.Append("and ms.EnterpriseName ='" &
Me.CallsByScripCombo.SelectedText & "' ")
sb.Append(" GROUP BY rcd.DateTime, rcd.DialedNumberString,
rcd.TargetLabel, r.EnterpriseName, ms.EnterpriseName,
rcd.FinalObjectID, rc.EnterpriseName, rcd.ANI ")
sb.Append("Order by rcd.DateTime ")
Dim Conn As SqlConnection = New SqlConnection(myConnString)
Dim DNDS As DataSet = New DataSet
Dim Adp As SqlDataAdapter = New
SqlDataAdapter(sb.ToString.ToString, Conn)
Adp.Fill(DNDS, "temp1")
Dim delUIUpdate As New DelegateUIUpdate(AddressOf UIUpdate)
Invoke(delUIUpdate, Me.CallsDataGridView, DNDS)
Conn.Close()
End Sub
Sub UIUpdate(ByVal dgv As DataGridView, ByVal ds As DataSet)
dgv.DataSource = ds.Tables(0).DefaultView
Me.CallsQueryButton.Enabled = True
End Sub- Hide quoted text -
- Show quoted text -
Oops I forgot to mention that the issue in in the sql query when I
call Me.CallsByScripCombo.SelectedText. I works fine when I access the
values of the other controls like the datetimechooser and textbox.
thanks!
.
- References:
- How do I access ComboBox.SelectedText from another thread?
- From: Paulers
- Re: How do I access ComboBox.SelectedText from another thread?
- From: Tom Shelton
- Re: How do I access ComboBox.SelectedText from another thread?
- From: Paulers
- How do I access ComboBox.SelectedText from another thread?
- Prev by Date: Re: How do I access ComboBox.SelectedText from another thread?
- Next by Date: Re: How do I access ComboBox.SelectedText from another thread?
- Previous by thread: Re: How do I access ComboBox.SelectedText from another thread?
- Next by thread: Re: How do I access ComboBox.SelectedText from another thread?
- Index(es):