So I have a label on a form that is supposed to receive text and add it to the label so you can see the progress. (some of code is like this just to test)
As you can see I've tried several things and no matter what the labels text will not update. The first message box pops up with the correct text so it is getting passed, but the label and LastText are not updated (the second message box is always empty). Any ideas?
-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
Code:
Public Class info
Public Result As String = ""
Private LastText As String = ""
Public Sub sMessage(ByVal value As String)
If Me.InvokeRequired Then
Me.BeginInvoke(New delSendText(AddressOf SendText), value)
Else
SendText(value)
End If
End Sub
Private Delegate Sub delSendText(ByVal value As String)
Private Sub SendText(ByVal value As String)
Application.DoEvents()
MsgBox(value)
update_lbl.Text = value
update_lbl.Refresh()
LastText = value
End Sub
Private Sub info_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Result = ""
Application.DoEvents()
End Sub
Private Sub update_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles update_btn.Click
Result = "update"
End Sub
Private Sub cancel_btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancel_btn.Click
Result = "cancel"
End Sub
Private Sub update_lbl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles update_lbl.Click
update_lbl.Text = LastText
Application.DoEvents()
MsgBox(LastText)
End Sub
End Class
-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!