473,322 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

"Imports Microsoft.VisualBasic" doesn't import

I've built a control. At the top of my control, I have this:

Imports Microsoft.VisualBasic

Then, later, I call a function like this:

DateTime.Now.Year.ToString()

This works fine on my machine. My coworker takes the exact same file,
compiles it, and gets errors until he explicitly writes out the function as:
microsoft.VisualBasic.DateAndTime.Now.Year.ToStrin g()

Why?

This has happened before and only seems to affact the microsoft.VisualBasic
namespace. On his computer, it just doesn't seem to import it.

-Darrel
Nov 18 '05 #1
2 4193
On Wed, 18 Aug 2004 17:30:58 -0500, "darrel" <no*****@hotmail.com>
wrote:

microsoft.VisualBasic.DateAndTime.Now.Year.ToStri ng()

Why?
DateTime is a System.ValueType
This has happened before and only seems to affact the microsoft.VisualBasic
namespace. On his computer, it just doesn't seem to import it.


He'd also have to use a M instead of a m for it to work. Are you
using this name space for anything in particular cause I don't think
you need it in most cases.

-Adam
Nov 18 '05 #2
The frameowk is probably getting confused because that function doesn't
require the VisualBasic library at all. You can say the exact same thing
with System.DateTime.Now.Year.ToString(). If the System and
Microsoft.VisualBasic namespaces are both imported, how does the
DateTime.Now.Year.ToString() code know which namespace you are referencing?
It doesn't, which is why it generates the error unless the VisualBasic
namespace is specified as then there isn't any confusion by the compiler.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"darrel" <no*****@hotmail.com> wrote in message
news:en**************@tk2msftngp13.phx.gbl...
I've built a control. At the top of my control, I have this:

Imports Microsoft.VisualBasic

Then, later, I call a function like this:

DateTime.Now.Year.ToString()

This works fine on my machine. My coworker takes the exact same file,
compiles it, and gets errors until he explicitly writes out the function
as:
microsoft.VisualBasic.DateAndTime.Now.Year.ToStrin g()

Why?

This has happened before and only seems to affact the
microsoft.VisualBasic
namespace. On his computer, it just doesn't seem to import it.

-Darrel

Nov 18 '05 #3

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

Similar topics

15
by: Rob Evans | last post by:
Is there a way of stopping " - Microsoft Internet Explorer" being added to the browser window title ? eg, I want it to say: My Website Name and not My Website Name - Microsoft Internet...
4
by: Georges Heinesch | last post by:
Hi. This question might seem trivial, but I didn't find any solution. By error, I created some event for a subform (subfrmTest). Hence, an entry in the VBA editor list was made...
0
by: darrel | last post by:
(Apologies for the duplicate post. OE seems to have lost a weeks worth of newsgroup postings and I can't seem to get it to re-sync the lost days.) I've built a control. At the top of my control,...
3
by: Dan Nash | last post by:
Hi guys Is there a way to get rid of the "- Microsoft Internet Explorer" part of the title bar? I've got a popup with "Contact Details :: " and it just looks untidy with the IE stuff. Cheers...
1
by: A. Nonymous | last post by:
If I make my own Namespace do I have to compile it to a DLL before I can use the line: Imports MyNamespace anywhere? TIA
2
by: danthman | last post by:
Can someone tell me why the following VB.NET code doesn't work? ----- Imports System.Data.SqlClient Partial Class PageHeader Inherits System.Web.UI.UserControl Public ConnectionObjG As...
7
by: pcnerd | last post by:
In Java I can use, for example, " Imports java.util.* ". Can I use, for example, " Imports System.* " instead of several different "Imports" statements? Thank you. David
1
by: Alexander Eisenhuth | last post by:
Hi, PyLint says that "Relative imports" ... are worth to be warned . And I ask myself why? ----------------- Example directory structure --------- Sound/ Top-level package...
5
by: kimiraikkonen | last post by:
Hello, I want to ask about "imports" statement. Some projects must be inserted with "imports xxxx" statements before beginning coding. But how do i know when to use or do i have to use "imports"...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.