473,796 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB 2005, immediate window

Hi,

I feel fooled.. In the immediate window, if I enter

? DateTime.Now.Ki nd

I get "Unspecifie d {0}". The result - I expected "local" - lead to some time
consuming deliberations. Today, I execute

MsgBox(DateTime .Now.Kind)
MsgBox(DateTime .Now.Kind.ToStr ing)

as part of the source code, and I get "2" and "local" (where 2 = local, so
this is consistent).

Why does the immediate window lie? There, If I execute

?DateTime.Now.K ind.ToString

I even get the message "Run-time exception thrown :
System.Argument Exception - Cannot find the method on the object instance."

What? Did I overlook anything?
Armin

Jun 20 '07 #1
4 3092

"Armin Zingler" <az*******@free net.dewrote in message
news:ud******** ******@TK2MSFTN GP02.phx.gbl...
Hi,

I feel fooled.. In the immediate window, if I enter

? DateTime.Now.Ki nd

I get "Unspecifie d {0}". The result - I expected "local" - lead to some
time
consuming deliberations. Today, I execute

MsgBox(DateTime .Now.Kind)
MsgBox(DateTime .Now.Kind.ToStr ing)

as part of the source code, and I get "2" and "local" (where 2 = local, so
this is consistent).

Why does the immediate window lie? There, If I execute

?DateTime.Now.K ind.ToString

I even get the message "Run-time exception thrown :
System.Argument Exception - Cannot find the method on the object instance."

What? Did I overlook anything?
The fact that you cannot issue that statement like that, because it needs an
object to work with to complete the statement.

dim strhldkind as string

strhldkind = datetime.now.ki nd.tostring

Now, after executing that statement in code, the *strhldkind* is now an
*object* and in the immediate window you can enter this.

?strhldkind

It will show *local*

or you could have done this in code

dim strhldkind as string = datetime.now.ki nd.tostring

Jun 20 '07 #2
"Mr. Arnold" <MR. Ar****@Arnold.c omschrieb
>
"Armin Zingler" <az*******@free net.dewrote in message
news:ud******** ******@TK2MSFTN GP02.phx.gbl...
Hi,

I feel fooled.. In the immediate window, if I enter

? DateTime.Now.Ki nd

I get "Unspecifie d {0}". The result - I expected "local" - lead to
some time
consuming deliberations. Today, I execute

MsgBox(DateTime .Now.Kind)
MsgBox(DateTime .Now.Kind.ToStr ing)

as part of the source code, and I get "2" and "local" (where 2 =
local, so this is consistent).

Why does the immediate window lie? There, If I execute

?DateTime.Now.K ind.ToString

I even get the message "Run-time exception thrown :
System.Argument Exception - Cannot find the method on the object
instance."

What? Did I overlook anything?

The fact that you cannot issue that statement like that, because it
needs an object to work with to complete the statement.
It is a complete statement. The result of the ToString method *is* an
object, it's a String. The "?" (aka print) command prints strings like they
are. It can take any expression as an argument, be it one simple variable
like strhldkind or be it a more complex expression. It does work with
"?datetime.now. kind", so why shouldn't it work with one more ".tostring" ?
Just because it's one more dot? This doesn't make sense.

Or, why does, for example,
"?System.Window s.Forms.Screen. PrimaryScreen.B itsPerPixel" work as well as
"?System.Window s.Forms.Screen. PrimaryScreen.B itsPerPixel.ToS tring"?
without an exception?
dim strhldkind as string

strhldkind = datetime.now.ki nd.tostring

Now, after executing that statement in code, the *strhldkind* is now
an *object* and in the immediate window you can enter this.

?strhldkind

It will show *local*

or you could have done this in code

dim strhldkind as string = datetime.now.ki nd.tostring

Well, the problem is that it should also work like I explained before.

In addition, it is still wrong that it outputs "unspecifie d" in the
immediate window whereas I get "local" in the code.
Armin

Jun 21 '07 #3
On Jun 20, 11:22 pm, "Armin Zingler" <az.nos...@free net.dewrote:
"Mr. Arnold" <MR. Arn...@Arnold.c omschrieb


"Armin Zingler" <az.nos...@free net.dewrote in message
news:ud******** ******@TK2MSFTN GP02.phx.gbl...
Hi,
I feel fooled.. In the immediate window, if I enter
? DateTime.Now.Ki nd
I get "Unspecifie d {0}". The result - I expected "local" - lead to
some time
consuming deliberations. Today, I execute
MsgBox(DateTime .Now.Kind)
MsgBox(DateTime .Now.Kind.ToStr ing)
as part of the source code, and I get "2" and "local" (where 2 =
local, so this is consistent).
Why does the immediate window lie? There, If I execute
?DateTime.Now.K ind.ToString
I even get the message "Run-time exception thrown :
System.Argument Exception - Cannot find the method on the object
instance."
What? Did I overlook anything?
The fact that you cannot issue that statement like that, because it
needs an object to work with to complete the statement.

It is a complete statement. The result of the ToString method *is* an
object, it's a String. The "?" (aka print) command prints strings like they
are. It can take any expression as an argument, be it one simple variable
like strhldkind or be it a more complex expression. It does work with
"?datetime.now. kind", so why shouldn't it work with one more ".tostring" ?
Just because it's one more dot? This doesn't make sense.

Or, why does, for example,
"?System.Window s.Forms.Screen. PrimaryScreen.B itsPerPixel" work as well as
"?System.Window s.Forms.Screen. PrimaryScreen.B itsPerPixel.ToS tring"?
without an exception?
dim strhldkind as string
strhldkind = datetime.now.ki nd.tostring
Now, after executing that statement in code, the *strhldkind* is now
an *object* and in the immediate window you can enter this.
?strhldkind
It will show *local*
or you could have done this in code
dim strhldkind as string = datetime.now.ki nd.tostring

Well, the problem is that it should also work like I explained before.

In addition, it is still wrong that it outputs "unspecifie d" in the
immediate window whereas I get "local" in the code.

Armin
I'm inclined to believe it is a bug. Because it displays properly in
the Immediate window when using C#, but I get the same results you do
when using VB.

Chris

Jun 21 '07 #4
"Chris Dunaway" <du******@gmail .comschrieb
Well, the problem is that it should also work like I explained
before.

In addition, it is still wrong that it outputs "unspecifie d" in
the immediate window whereas I get "local" in the code.

Armin

I'm inclined to believe it is a bug. Because it displays properly
in the Immediate window when using C#, but I get the same results
you do when using VB.
...forwarded:
http://connect.microsoft.com/VisualS...dbackID=283718
http://connect.microsoft.com/VisualS...dbackID=283720

Armin

Jun 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2923
by: Dave | last post by:
I'm getting different results when I display a value in the Output window as opposed to the Immediate window. Why? Code to recreate problem: 'Purpose: Get different results from Output window than Immediate ' window.
2
12832
by: Jon Davis | last post by:
How do I get the Immediate window back? It seems to be gone. Command window doesn't work. "View" menu items don't seem to show it Jon
11
11872
by: Mike | last post by:
Is there an Immediate window in vb.net 2003? If so, how do you bring it up?
3
3437
by: Russell Stevens | last post by:
Can anyone tell me how to get to the immediate window in VS2005. The help file says (when debugging) to click Debug, Windows, Immediate. There is no Immediate window listed there, nor anywhere else I can find it. Also, is there a trick now to single step. I can't find that anywhere either. Thanks Russ Stevens
1
1336
by: DougS | last post by:
When I'm debugging an ASP 2.0 application and I'm trying to use the immediate window to interrogate some classes I cant reference anything in my code. When I type ?dvClient.Rows.Count it gives me no intellisense and it says object not found. I also have VS 2003 installed on this machine. What am I doing wrong? Thanks, DougS
2
2597
by: dgk | last post by:
Using VS2005 Standard Edtion, I have an Immediate window during ASP debugging. My co-worker, using VS2005 Team Edtion does not have an Immediate window. He does have a Command window, which is sort of ok but doesn't have intellisense. Documentation shows that editions above Express do have immediate windows. We've looked under Debug, View, and just about everywhere else. I don't see the Immediate window under View on my system either,...
6
2842
by: Frank Rizzo | last post by:
I am using the Immediate Window a lot to see the progress of the application. In VS2003, if your cursor was at the very bottom, the window would scroll down whenever something new showed up. If your cursor was somewhere in the middle of the text output, then there would be no scrolling. In VS2005, the Immediate Window scrolls regardless of where the cursor is which is very annoying. Sometimes you want to go back up in the window to...
4
2119
by: mgfine | last post by:
We're new to using VB 9 and we cannot invoke an immediate command window from an immediate window. Typing >cmd in the immediate window does bring up a command window but we're looking for the immediate command window that we used in VB 7. Thanks.
0
2251
by: mgfine | last post by:
This question was first posted in the VB forum: We're new to using VB 9 (Visual Studio.Net 2007) and we cannot invoke an immediate command window from an immediate window. Typing >cmd in the immediate window does bring up a command window but we're looking for the immediate command window that we have used in VB 7. Thanks.
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10230
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.