Imports System.Drawing Imports System.Runtime.CompilerServices Public Module Extensions Public Function ToIcon(image As Image) If TypeOf image Is Bitmap Then Return Icon.FromHandle(CType(image, Bitmap).GetHicon) End If Return Nothing End Function End Module