I copied code from this thread:


And, I changed it to this
Dim g As Graphics
Dim sz As New SizeF

sz = g.MeasureString("Test String", Me.Font)
But I am getting the "Object reference not set to an instance of an object" error. I don't have much experience with the Graphics class, and I can't for the life of me figure out what to do. Simply putting new in front of Graphics doesn't work. As you can see from the link, that post used e.Graphics, but I am doing this in a different event (Mouse Up), which doesn't have e.Graphics. Any ideas?

Thanks