Hi All
Trying to implement a confirmation sequence regarding the loading of an image in a picturebox. I need to know this for once the image is loaded I am going to print it using the printdocument_printpage sub of the printdocument class. I am trying to use the picturebox events namely the picturebox1_loadcompleted event. Below is the code stream I am using. I am thinking that the loadasync(file) should initiate the event stream but that's not happening. Of course I have installed the event handlers but I guess I am missing something like "the fire command". Any insight would be greatly appreciated.
imgin = False 'boolean variable
PictureBox1.Image = Nothing
PictureBox1.WaitOnLoad = False
PictureBox1.LoadAsync("image")
Do While imgin = False
Loop
'print the pricturebox
Private Sub PictureBox1_LoadCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles PictureBox1.LoadCompleted
'signal image loaded
imgin = True
End Sub
As you can see I am trying to use a simple semaphore scheme using the loadcompleted event. I have tried the
Do While PictureBox1.Image Is Nothing
Loop
which does basically does nothing. When I saw the loadcompleted event I thought for sure this would "do the trick". Thanks in advance.
Ideprize
Trying to implement a confirmation sequence regarding the loading of an image in a picturebox. I need to know this for once the image is loaded I am going to print it using the printdocument_printpage sub of the printdocument class. I am trying to use the picturebox events namely the picturebox1_loadcompleted event. Below is the code stream I am using. I am thinking that the loadasync(file) should initiate the event stream but that's not happening. Of course I have installed the event handlers but I guess I am missing something like "the fire command". Any insight would be greatly appreciated.
imgin = False 'boolean variable
PictureBox1.Image = Nothing
PictureBox1.WaitOnLoad = False
PictureBox1.LoadAsync("image")
Do While imgin = False
Loop
'print the pricturebox
Private Sub PictureBox1_LoadCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles PictureBox1.LoadCompleted
'signal image loaded
imgin = True
End Sub
As you can see I am trying to use a simple semaphore scheme using the loadcompleted event. I have tried the
Do While PictureBox1.Image Is Nothing
Loop
which does basically does nothing. When I saw the loadcompleted event I thought for sure this would "do the trick". Thanks in advance.
Ideprize
Last edited: