473,394 Members | 1,875 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,394 software developers and data experts.

Not valid namespace

DDF
I took this snippet from a book I foudn online. Public Class Demo
Public Structure ValueDemo
Public X As Integer
End Structure
Public Class RefDemo
Public Y As Integer
End Class
Public Sub InstantiateTypes()
' This line declares a ValueDemo variable
Dim DemoStructure As ValueDemo
' This line creates an instance of ValueDemo on the stack
DemoStructure = New ValueDemo()
' The variable is ready to receive data.
DemoStructure.X = 15
' This line declares a RefDemo variable, but doesn't
' create an instance of the class
Dim DemoClass As RefDemo
' This line actually creates the object
DemoClass = New RefDemo()
' And you can now assign value to its members
DemoClass.Y = 15
End Sub
End ClassWhen trying to compile The ide si telling me that this is not a valid namespace. Can anyone help...Thanks...
Nov 21 '05 #1
3 1500
Hi,

I am not getting any errors compiling the code listed below.

Ken
---------------------

"DDF" <mr*****@optonline.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I took this snippet from a book I foudn online.
Public Class Demo
Public Structure ValueDemo
Public X As Integer
End Structure
Public Class RefDemo
Public Y As Integer
End Class
Public Sub InstantiateTypes()
' This line declares a ValueDemo variable
Dim DemoStructure As ValueDemo
' This line creates an instance of ValueDemo on the stack
DemoStructure = New ValueDemo()
' The variable is ready to receive data.
DemoStructure.X = 15
' This line declares a RefDemo variable, but doesn't
' create an instance of the class
Dim DemoClass As RefDemo
' This line actually creates the object
DemoClass = New RefDemo()
' And you can now assign value to its members
DemoClass.Y = 15
End Sub
End Class
When trying to compile The ide si telling me that this is not a valid
namespace. Can anyone help...

Thanks...
Nov 21 '05 #2

Did you create a windows app or was is a console windows app? I added this
code to the form load of a form and was not able to get any further because
the instantiatetype() was giving me an error. I was going to make some
modes to pop up message boxs.


"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Hi,

I am not getting any errors compiling the code listed below.

Ken
---------------------

"DDF" <mr*****@optonline.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I took this snippet from a book I foudn online.
Public Class Demo
Public Structure ValueDemo
Public X As Integer
End Structure
Public Class RefDemo
Public Y As Integer
End Class
Public Sub InstantiateTypes()
' This line declares a ValueDemo variable
Dim DemoStructure As ValueDemo
' This line creates an instance of ValueDemo on the stack
DemoStructure = New ValueDemo()
' The variable is ready to receive data.
DemoStructure.X = 15
' This line declares a RefDemo variable, but doesn't
' create an instance of the class
Dim DemoClass As RefDemo
' This line actually creates the object
DemoClass = New RefDemo()
' And you can now assign value to its members
DemoClass.Y = 15
End Sub
End Class
When trying to compile The ide si telling me that this is not a valid
namespace. Can anyone help...

Thanks...

Nov 21 '05 #3
Hi,

A windows form app.

Public Class Form1

Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim regTest As New System.Text.RegularExpressions.Regex("tHe",
System.Text.RegularExpressions.RegexOptions.Ignore Case)

Dim strCheck As String = "This is the test string. I the regex works."

Dim m As System.Text.RegularExpressions.MatchCollection

m = regTest.Matches(strCheck)

Me.Text = m.Count.ToString

Dim strDate As String = "2005-01-10"

Dim dt As Date = Date.ParseExact(strDate, "yyyy-mm-dd", New
Globalization.CultureInfo("en-US"))

Me.Text = dt.ToShortDateString

Dim environmentVariables As IDictionary =
Environment.GetEnvironmentVariables()

Dim de As DictionaryEntry

For Each de In environmentVariables

Trace.WriteLine(String.Format(" {0} = {1}", de.Key, de.Value))

Next de

Me.Text = Environment.GetEnvironmentVariable("ALLUSERSPROFIL E") & "\Start
Menu"

Dim d As New Demo

d.InstantiateTypes()

End Sub

End Class

Public Class Demo

Public Structure ValueDemo

Public X As Integer

End Structure

Public Class RefDemo

Public Y As Integer

End Class

Public Sub InstantiateTypes()

' This line declares a ValueDemo variable

Dim DemoStructure As ValueDemo

' This line creates an instance of ValueDemo on the stack

DemoStructure = New ValueDemo

' The variable is ready to receive data.

DemoStructure.X = 15

' This line declares a RefDemo variable, but doesn't

' create an instance of the class

Dim DemoClass As RefDemo

' This line actually creates the object

DemoClass = New RefDemo

' And you can now assign value to its members

DemoClass.Y = 15

End Sub

End Class

Ken

-------------------

"Dmension" <df****@napcosecurity.com> wrote in message
news:ec****************@TK2MSFTNGP09.phx.gbl...

Did you create a windows app or was is a console windows app? I added this
code to the form load of a form and was not able to get any further because
the instantiatetype() was giving me an error. I was going to make some
modes to pop up message boxs.


"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:%2******************@TK2MSFTNGP12.phx.gbl...
Hi,

I am not getting any errors compiling the code listed below.

Ken
---------------------

"DDF" <mr*****@optonline.net> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
I took this snippet from a book I foudn online.
Public Class Demo
Public Structure ValueDemo
Public X As Integer
End Structure
Public Class RefDemo
Public Y As Integer
End Class
Public Sub InstantiateTypes()
' This line declares a ValueDemo variable
Dim DemoStructure As ValueDemo
' This line creates an instance of ValueDemo on the stack
DemoStructure = New ValueDemo()
' The variable is ready to receive data.
DemoStructure.X = 15
' This line declares a RefDemo variable, but doesn't
' create an instance of the class
Dim DemoClass As RefDemo
' This line actually creates the object
DemoClass = New RefDemo()
' And you can now assign value to its members
DemoClass.Y = 15
End Sub
End Class
When trying to compile The ide si telling me that this is not a valid
namespace. Can anyone help...

Thanks...


Nov 21 '05 #4

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

Similar topics

8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
8
by: Anthony Williams | last post by:
Morning all, I'm having a wee problem with a project I'm working on at the moment. I'm leading my company into producing a website, based upon Web Standards, which will be created using XHTML...
8
by: Charles | last post by:
I do not understand why I am getting a "Specified cast is not valid" error, since it has worked before. Something has changed and I am not really sure what it could be. I am looking for something...
4
by: Todd Perkins | last post by:
Hello all, surprisingly enough, this is my first newsgroup post, I usually rely on google. So I hope I have enough info contained. Thank you in advance for any help! Problem: I am getting...
2
by: Pathogenix | last post by:
Greetings, I'm trying to fix a web service client which has been implemented in a dailywtf worthy manner. I've decided to rip all the old code out and start again from the proxy generated by...
1
by: coz | last post by:
Someone please help! I cannot for the life of me get a web resource in asp.net 2.0 to return any content. I know I have correctly embedded my resources (because I can manually get the resources...
1
by: Chris Lieb | last post by:
I have an XML Schema file that I know is correct becuase I currently use it in a VB6 program to validate XML documents. Also, if I load an XML file into VS2005 that is not valid against this...
7
by: tshad | last post by:
I have a page that is showing as: Page.IsValid = False on postback when my submit button is pressed but none of my Validators have fired so there is no error message. How do I find out what...
5
by: Boris | last post by:
Is this a valid C++ program (according to the C++ standard)? I ask as I'm trying to port a Windows library to Solaris, and the Solaris C++ compiler reports an error (The name x is ambiguous in ns1:...
5
by: WDS | last post by:
I was compiling some old code with a new compiler and it flagged a statement as an error. This code compiled (and ran) fine with an older version of the same compiler. The following snippet...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.