title: how to refresh or redrawn the panel area again in windows forms application
body: <p>I am using dynamically label with some text and images. I'm using them inside my loadflow function</p>
  
  <p>Images which are onto the panel are loaded correctly and when I try to retrieve again after new DB call, images are not redrawn or refreshed.</p>
  
  <p>I have tried already with some inbuilt functions like Invalidate, Refresh, Update but doesn't work at all.</p>
  
  <p>My label with Image and Text looks as below</p>
  
  <p><img src="https://i.stack.imgur.com/bFMy1.png" alt="enter image description here"></p>
  
  <p>My code is </p>
  
  <pre><code> Private Function LoadFlow()
  
      Dim i As Integer = 0
      'Check if datatable has rows and is not null
      If dtFlowPanel.Rows.Count &gt; 0 AndAlso dtFlowPanel IsNot Nothing Then
  
  
          cboCheckPointStatus.DataSource = dtFlowPanel
          cboCheckPointStatus.DisplayMember = "CHECKPOINTNAME"
          cboCheckPointStatus.ValueMember = "TERMINALCHECKPOINTID"
  
  
          UltraPanel1.Visible = True
  
          Do While (i &lt; dtFlowPanel.Rows.Count)
  
  
              'CheckPointName Label
              lblCheckPointName = New Label
              lblCheckPointName.Text = dtFlowPanel.Rows(i)("CHECKPOINTNAME").ToString()
              lblCheckPointName.Name = "CheckPoint"
              lblCheckPointName.ForeColor = Color.White
              lblCheckPointName.AutoSize = False
              lblCheckPointName.Height = 20
              lblCheckPointName.Width = 100
              lblCheckPointName.Location = New Point((i * 100), 50)
  
              'Round Circle Image Label
              lblImage1 = New Label
              lblImage1.Name = "Test" + i.ToString()
              lblImage1.Tag = i.ToString
  
              'If lblImage1.Name = "Test0" Then
              '    lblImage1.Image = Image.FromFile("c:\\Untitled1.png")
              'End If
              'If lblImage1.Name = "Test1" Then
              '    lblImage1.Image = Image.FromFile("c:\\Untitled1.png")
              'End If
              'If lblImage1.Name = "Test2" Then
              '    lblImage1.Image = Image.FromFile("c:\\Untitled2.png")
              'End If
              lblImage1.ImageAlign = ContentAlignment.MiddleRight
              lblImage1.BorderStyle = BorderStyle.None
              lblImage1.AutoSize = False
              lblImage1.Height = 20
              lblImage1.Width = 30
              lblImage1.Location = New Point((i * 100), 70)
  
              'Solid Black Line Image Label
              lblImage2 = New Label
              lblImage2.Name = "Test" + i.ToString()
              lblImage2.Tag = i.ToString
  
              lblImage2.Height = 20
              lblImage2.Width = 100
              lblImage2.Location = New Point((i * 100), 70)
  
  
              'Green Circle with Green Line
              If dtFlowPanel.Rows(i)("Flag") = 0 Then
                  lblImage1.Image = Image.FromFile("c:\\Untitled1.png")
                  lblImage2.Image = Image.FromFile("c:\\Line1.png")
                  'Yellow Circle with White Line
              ElseIf dtFlowPanel.Rows(i)("Flag") = 1 Then
                  lblImage1.Image = Image.FromFile("c:\\Untitled2.png")
                  lblImage2.Image = Image.FromFile("c:\\Line.png")
                  'Red Circle with White Line
              ElseIf dtFlowPanel.Rows(i)("Flag") = 2 Then
                  lblImage1.Image = Image.FromFile("c:\\Untitled.png")
                  lblImage2.Image = Image.FromFile("c:\\Line.png")
  
              End If
  
              'DatePicker
              dtpicker = New DateTimePicker
              dtpicker.Name = "Date" + i.ToString()
              dtpicker.Format = DateTimePickerFormat.Time
              dtpicker.ShowUpDown = True
              dtpicker.Height = 20
              dtpicker.Width = 95
              'horizontal
              dtpicker.Location = New Point((i * 100), 100)
  
              If Not IsDBNull(dtFlowPanel.Rows(i)("CheckPointTimeValue")) Then
                  dtpicker.Value = dtFlowPanel.Rows(i)("CheckPointTimeValue")
              End If
  
  
  
              Me.UltraPanel1.ClientArea.Controls.Add(lblImage1)
              Me.UltraPanel1.ClientArea.Controls.Add(lblImage2)
              Me.UltraPanel1.ClientArea.Controls.Add(dtpicker)
              Me.UltraPanel1.ClientArea.Controls.Add(lblCheckPointName)
  
              lblImage1.Refresh()
              lblImage2.Refresh()
  
              i = (i + 1)
  
          Loop
      Else
          UltraPanel1.Visible = False
      End If
      Return Nothing
  End Function
  </code></pre>