As I said in an earlier post I'm interested in getting my hands dirty with graphics in VB.NET. So I downloaded a small sample which (supposedly) displayed a circular form. I say 'supposedly' because the sample failed to compile. In fact when I loaded the sample into VB.NET, I got a huge notification saying that the sample code would have to be 'converted' to the current VB.NET version, and asked me to confirm, which I did.
These are the vital stats of my VB.NET:
MS Development Environment 2003, Version 7.1.3088
MS .NET Framework 1.1, Version 1.1.4322
Error--> Namespace or type 'Winforms' for the Imports 'System.Winforms' cannot be found.
I then exitted VB.NET completely and began again, with a new project (not the downloaded one). I entered the offending Imports statement and VB.NET flagged it as an error. I typed "Imports System." and then scanned the dropdown, but I could not see 'Winforms'.
But "Inherits System.Windows.Forms.Form" is accepted OK.
I have also read some articles where "Imports System.Winforms" is used quite a bit, so I do know that System.Winforms should be an importable library. But it just does not work at my place! Wotgivz?
Primarily, I was checking out how "clipping region" was effected in .NET. Since I had not a clue about how to go about it, I very rapidly drove myself up the wall!
Private Sub btnClip_Click(...)
Private Sub Form1_Paint(...)
Dim cliprgn As Drawing2D.RegionData
Dim cliprgnarray(4) As Point
Msgbox("Seting the first value...")
Msgbox("First value set OK!")
The idea is that I click the btnClip button (which forces the form to repaint) to set up a clipping region on the form, and then draw something on the form which should appear clipped.
However, when I run the code and click the button, the first messagebox displays, but not the second. That means the code has executed past the first messagebox. I click the OK button of the messagebox, and then the program grinds to a halt and the following error message comes up:
"An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll
Additional information: Object reference not set to an instance of an object."
What object? I broke (pressed [Break]) the program and the beauty is that the error points to the Me.Refresh() statement in btnClip_Click(...)! That is, the error is attributed to a statement that has already been executed! Wotgivz?