I am writing a graph program that plots data in real time. At the moment I am using two picture boxes, I draw the data block (50ms worth of data) onto the background picturebox and then use BitBlt to copy this block onto the front picbox. This works great. However I am trying to replace to background picturebox with a memory dc.

This is the code I am using:

Code:
dim dc As Long            ' Memory DC for double buffering
dim mempic As PictureBox  ' Memory picture box used for double buffering

dc = CreateCompatibleDC(UserControl.hdc)
If dc = vbNull Then StatusBar1.SimpleText = "Failed to create memory DC"

Set mempic = PicMain ' copy picmain attributes
SelectObject dc, mempic
picmain is my front picturebox. I cant get this to work though. If I run run the usercontrol it comes up blank. Any ideas?

Cheers