vbCrLf wierdness

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Been a long time since I've played with this, just got .Net version of
Visual Basic. Having annoyance with a real simple thing. I'm adding a
tooltip to a control like:

Me.ToolTip1.SetToolTip(Me.SubName,"This is a two-line" & vbCrLf & _
"tooltip.")

If I ctrl-F5 from the code menu, it compiles and runs OK (breaks the
tooltip into two lines). If I go to the form design window, I get the
error:

"The variable 'vbCrLf' is either undeclared or was never assigned."

Didn't think I needed to declare a system constant. When I go back to
the code view, VB has ever so kindly deleted the tooltip from the
control.

This has got to be something real stupid on my part, but I'm blocked.

p
 
* (e-mail address removed) (Paul) scripsit:
Been a long time since I've played with this, just got .Net version of
Visual Basic. Having annoyance with a real simple thing. I'm adding a
tooltip to a control like:

Me.ToolTip1.SetToolTip(Me.SubName,"This is a two-line" & vbCrLf & _
"tooltip.")

If I ctrl-F5 from the code menu, it compiles and runs OK (breaks the
tooltip into two lines). If I go to the form design window, I get the
error:

"The variable 'vbCrLf' is either undeclared or was never assigned."

Didn't think I needed to declare a system constant. When I go back to
the code view, VB has ever so kindly deleted the tooltip from the
control.

Use 'ControlChars.NewLine' instead.
 
Hi Paul,

I copied it in used a txtbox and no problem at all VB.net 2003

I got a 2 line tooltip.

Cor
 
Tried that. Now the error changed to:

The variable 'NewLine' is either undeclared or was never assigned.
 
Did you put this in the auto-generated InitializeComponent method?
if so, try to put it in the constructor after the InitializeComponent call
 
Is this VS 2002 or VS2003? I have no trouble with it in VS2003, but in
2002, I think you might need to import the namespace (it has been a while
since I used 2002, so I'm not sure), for example:
Imports VB = Microsoft.VisualBasic

Dick
--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Apparently a VB.Net glitch. I checked the project Properties to ensure
the Imports were correct (they were). Clicked on one of them, clicked on
Apply then OK. Now everything works right.

p
 
* Paul Opitz said:
Tried that. Now the error changed to:

The variable 'NewLine' is either undeclared or was never assigned.

Mhm... Does that even occur in a blank project?
 
Back
Top