C
Curt Emich
I always thought writing a simple diagnostic message in a message box would
be pretty simple. Not in .NET.
First, I wrote this amazingly complex piece of code:
MessageBox.Show("yer mama")
It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference
to that method in my project". I muzed correctly. So I added a reference
to System.Windows.Forms, which is where our beloved "MessageBox" method
resides.
Nothing. So at the top of my file, I wrote:
Imports System.Windows.Forms
Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like
this:
System.Windows.Forms.MessageBox.Show("yer mama")
It compiles now, but I never see "yer mama" anywhere on the screen. It's
inside this function:
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
System.Windows.Forms.MessageBox.Show("Yer mama")
End Sub
Maybe it's just not firing this sub, but that's kinda why the diagnostic is
there. I wanna find out if it is. Does this really have to be so
complicated?
I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be
enough that they're listed under "references" in the solution explorer? Or
even written manually at the top of the file?
Any insights you can give me would be greatly appreciated.
be pretty simple. Not in .NET.
First, I wrote this amazingly complex piece of code:
MessageBox.Show("yer mama")
It wouldn't even complile. "Gee...", I mused. "Maybe there's no reference
to that method in my project". I muzed correctly. So I added a reference
to System.Windows.Forms, which is where our beloved "MessageBox" method
resides.
Nothing. So at the top of my file, I wrote:
Imports System.Windows.Forms
Still, it wouldn't compile. Finally, I prefixed my call to MessageBox like
this:
System.Windows.Forms.MessageBox.Show("yer mama")
It compiles now, but I never see "yer mama" anywhere on the screen. It's
inside this function:
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
DropDownList1.SelectedIndexChanged
System.Windows.Forms.MessageBox.Show("Yer mama")
End Sub
Maybe it's just not firing this sub, but that's kinda why the diagnostic is
there. I wanna find out if it is. Does this really have to be so
complicated?
I've run into situations in the past where I've had to spell out simple
methods by fully qualifying their namespaces. Why is that? Shouldn't it be
enough that they're listed under "references" in the solution explorer? Or
even written manually at the top of the file?
Any insights you can give me would be greatly appreciated.