I'm upgrading an application using Mappoint COM from VB6 to VB.NET. In old application the method copymap() runs perfectly, but in VB.NET it doesn't work very well.
When I call this method not always copy the image to clipboard. See this code:
Dim iData As IDataObject = Clipboard.GetDataObject()
Dim bmpScreen As System.Drawing.Bitmap
Dim Pepe() As String
Pepe = iData.GetFormats()
If iData.GetDataPresent(DataFormats.Bitmap) Then
' Yes it is, so store it in the file.
bmpScreen = CType(iData.GetData(DataFormats.Bitmap), _
bmpScreen.Save(Application.StartupPath & "\foto.bmp")
' If not correct format, error message.
' I don't see how this could possibly
' happen, by the way.
MsgBox("The map is not in the clipboard")
It doesn't works always, it seems that mappoint is busy and not copy to the clipboard.
Anybody knows solution for it?
This feature is very important for my application, and in VB6 it runs very well...
Thank you very much, and sorry for my english