Refresh main form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How can i correctly refresh a form1 (running in background) from an active
form2?

Form1 have a thumbnail and it does not refresh, it becomes transparent or
invisible.

Thanks in advance,
Ray
 
It didn't work. Refresh method only redraw text controls, not graphic controls.

Regards,
Ray
 
Without seeing more code it's hard to say. My guess is it's not a failure
in the app, but a failure in the underlying control to handle all events
correctly. How is the thumbnail drawn? If it's custom, then you need to
make sure you're handing all the events and overriding properly so when the
area gets invalidated and redrawn, so does the thumbnail.

-Chris
 
This is a sample project. I can't refresh Form1's Picturebox and Label from
Form2:

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
PictureBox1.Image = CType(New Bitmap("\image1.jpg"), Image)
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Form2 As New Form2
Form2.Show()
End Sub
End Class

Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Close()
End Sub

Private Sub Form2_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Dim Form1 As New Form1
Form1.PictureBox1.Image = CType(New Bitmap("\image2.jpg"), Image)
Form1.PictureBox1.Refresh()
Form1.Label1.Text = "new text"
Form1.Label1.Refresh()
Form1.Refresh()
End Sub
End Class

Thanks in advance,
Ray
 
Back
Top