473,382 Members | 1,720 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,382 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 4202
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"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.