I am working on a small application that includes several Label controls and I would like to update the text in these controls. Thus far, the only things that works is to delete the control, then recreate it. I am certain that there is a better way, but I have not yet found it.
Following is a simplified version of my code that shows what I have tried that doesn't work.
Can you please tell me what to change to make this work. Thanks!Code:Public Class frmMyTime Dim gTime As String Dim lblTime As Label Private Sub frmMyTime_Load(sender As Object, e As EventArgs) Handles Me.Load lblTime = New label Me.Controls.Add(lblTime) End Sub Private Sub frmMyTime_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint lblTime.Text = gTime End Sub Private ub GetTime() gTime = DateTime.Now.ToString("HH:mm:ss") Me.Refresh() End Sub Public Sub frmMyTime_MouseDown(sender As Object, e As MouseEventArgs) Handles MyBase.MouseDown GetTime() End Sub End Class




Reply With Quote
