hello,
i am a long time asp.net developer, but new to winform programming.
in the application ive been assigned, the mainform spawns a new thread to fetch a bunch of data from a method. this takes time, which is why its been placed into its own thread, allowing the rest of the ui to be usable:
Private m_getDashboardDataThread As Thread
...
'this is the method that gets the data and *currently* binds it to UI
m_getDashboardDataThread = New Thread(AddressOf GetDashboardData)
'not sure if this check is needed
If Not m_getDashboardDataThread.ThreadState = Threading.ThreadState.Running Then
m_getDashboardDataThread.IsBackground = True
m_getDashboardDataThread.Start()
End If
problem: how & where do i properly bind this data? currently its doing the databind in the thread-method. but thats not going to work when i move the DA method to the real DAL. plus, ive heard allowing a spawned thread access to the main form UI is a Bad Thing (tm). this true, btw?
anyway... what is the proper way to do this? the app needs to spawn a thread to get the data, get it back somehow and update the UI.
thanks for your help,
matt
i am a long time asp.net developer, but new to winform programming.
in the application ive been assigned, the mainform spawns a new thread to fetch a bunch of data from a method. this takes time, which is why its been placed into its own thread, allowing the rest of the ui to be usable:
Private m_getDashboardDataThread As Thread
...
'this is the method that gets the data and *currently* binds it to UI
m_getDashboardDataThread = New Thread(AddressOf GetDashboardData)
'not sure if this check is needed
If Not m_getDashboardDataThread.ThreadState = Threading.ThreadState.Running Then
m_getDashboardDataThread.IsBackground = True
m_getDashboardDataThread.Start()
End If
problem: how & where do i properly bind this data? currently its doing the databind in the thread-method. but thats not going to work when i move the DA method to the real DAL. plus, ive heard allowing a spawned thread access to the main form UI is a Bad Thing (tm). this true, btw?
anyway... what is the proper way to do this? the app needs to spawn a thread to get the data, get it back somehow and update the UI.
thanks for your help,
matt