what i like to do is show a animated pictureBox while another function is being executed. Now the only way i know to do this is by using a thread.
this is a sample of my code.
[code] Private Sub ThreadTask()
'the pictureBox proparty is set to false that is why i am setting it to true now
picLoad.Visible = True
Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Click
If txtSearchText.Text = "" Then
MsgBox("Search fields can be empty.", MsgBoxStyle.Critical, "Input Error")
trd = New Thread(AddressOf ThreadTask)
'This is the other function that is being executed and it is in another class
DisplayResult(dgvSearch, 5, txtSearchText.Text)
with the above code i get the following error "Cross-thread operation not valid" now i have read this article http://www.vcskicks.com/cross-thread.php
and that is based on C# can any one help me translate it to VB.NET
0 · ·