Sure. Your Canvas1 hasn't been initialized so it is still NULL.
Canvas1 would normally be the canvas of the view you are going to write to.
Canvas1.Initialize(Panel1)
width = Canvas1.MeasureStringWidth(t, Typeface.DEFAULT, 14)
or you can use a Bitmap
Private MyBitmap as Bitmap
MyBitmap.InitializeMutable(1,1) 'Ignore
Canvas1.Initialize(MyBitmap)
width = Canvas1.MeasureStringWidth(t, Typeface.DEFAULT, 14)