Quantcast
Channel: cross-thread UI updating?
Viewing all articles
Browse latest Browse all 12

cross-thread UI updating?

$
0
0
ok, so just a member-level scoped data variable, have the worker thread fill it, and dont let the UI touch it until its been filled. cool, that is part of what i have now...except my code now has the worker also binding the member variable to the UI controls -- which is bad, as i understand.

so how does one typically inform the UI thread that the worker is "finished" filling the data variable?


   Private m_getDataThread As Thread
   Private m_data As MyDataObj


   Private Sub Foo_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

      m_getDataThread = New Thread(AddressOf GetMyData)

      If Not m_getDashboardDataThread.ThreadState = Threading.ThreadState.Running Then
          m_getDataThread.IsBackground = True
          m_getDataThread.Start()
      End If

   End Sub

   Private GetMyData()
 
      m_data = FillDataFromWebService()

      'TODO: let UI know this worker is finished filling data...
      'raise an event, or set another member-variable "status" variable?

   End Sub



thanks! im almost there...

matt

Viewing all articles
Browse latest Browse all 12

Trending Articles