Which One Is Namespace And Which One Is Class
Nov 5, 2011Imports System.Windows.Forms.Form which one is namespace and which one is class?
View 5 RepliesImports System.Windows.Forms.Form which one is namespace and which one is class?
View 5 RepliesIf my namespace is Company.Application.EDI.Acknowledgement and if I stick with theprogramming practice of one class per file then should my class be saved asacknowledgement.vb? Are there any gotchas that will come up?
View 5 RepliesI've added a new class1.vb file to my vb.net project containing:
Namespace MyFunc1
Public Class MyFunc2
Public Function Add(ByVal n1 As Int16, ByVal n2 As Int16) As Int16
return n1 + n2 ' Edited from: "Add = n1 + n2" (same thing)
[code]....
In form1.vb I thought I used to be able to call my functions with:
n = MyFunc1.Add(15, 16)
The error says "it's not a member".These also don't work as expected:
n = MyFunc2.Add(15, 16)
n = MyFunc1.MyFunc2.Add(15, 16)
n = Add(15, 16)
I thought for sure, this used to work:
n = MyFunc1.Add(15, 16)
I have a code but cant get it to work. I have a .vb site with a namespace and a Class and a Sub.Then on my index.aspx site i cant to call this sub The 2 sites is in the root of my project, and the name of the project is CalendarWeek
My WeekController.vb is
Imports System
Imports System.Web.UI.WebControls.Calendar
Imports System.Globalization
[Code]...
I have a class within a library, with no root namespace, firstone.dll:
namespace first
public partial class one
public sub fun()
[Code]....
Is there a way to extend the class in a separate dll and still have access to the original class? I don't want to inherit the class just extend it.
I'm writing custom code in VS2005 Reports (SSRS / Report Builder). The code is working fine, but I have to make absolute references to assembly classes. For instance:For Each m As System.Text.RegularExpressions.Match In ...Is there any way to alias the reference to System.Text.RegularExpressions.Match, so that I can reuse it in a concise manner? I know in PHP, you'd do it like this:
use MyNamespace\MySubNamespace\MyClassVerboseName as MyClass
[...]
MyClass->MyMethod();
[code]......
I'm moving some stuff around in a program. How do I move a class (or enum, etc) to a different namespace? Right now I am getting 102 errors because even though VS can update name changes, I don't see how to get it to update a move to a difference namespace.
EDIT: Okay, to be more precise, I am moving a class up the namespace tree. So, not just a different namespace, but actually getting rid of the last namespace qualifier.
While going thru an msdn article, I found a reference to System.Query.Sequence class. But when I try to use it, I get error "Query is not a member of System"
vb.net
Public Sub Linq65()
Dim numbers = From n In System.Query.Sequence.Range(100, 50) _
Select New With {.Number = n, .OddEven = If(n Mod 2 = 1, "odd", "even")}
For Each n In numbers
[Code]...
The above code is vb.net version of this code from msdn. So what is the correct namespace of this class? Or I'm missing something else?
I am attempting to use the My.Computer.FileSystem namespace in a WPF VB.NET usercontrol library. I get no Intellisense etc for this namespace. I imagine I need to add a reference but no amount of googling has fixed this and VS.
View 1 RepliesI've currently got a class that has a bunch of functions within it that I'd like to group up. I can't seem to find a way to do this, as the functions interact with the objects within the class (so I can't use a structure for example). Namespaces are only allowed outside of Classes as are modules. Let's say I have Class Foo. Inside Class Foo there are six functions, three that are logically grouped together and another three that are as well.
Class Foo
Public Function moneyFoo1()
Public Function moneyFoo2()
Public Function moneyFoo3()
[code]....
this is what i want to do. I have a class library project into my solution. Into it i have a class. I want that class to be instantiated as soon as the solution starts. So it can be accesible from the other projects in the solution like this: Namespace.InstanceOfTheForm.Property Is there any way to do that? or something close to that?
[Code]...
I have a question regarding namespace names and classes: If I have a class called cVeloConnect in namespace VeloConnect.
[Code]...
I can't seem to find a clear answer as to how to import the proper namespace for ReportingService [URL]. I tried to follow the instruction here [URL] but there is no Add Web Service option showing when I create a console application. There is a service account. Should I just use that instead?
View 2 Replies1. create a blank VS2010 web project called "MySite" targeted at 4.0
2. create a new class object, calling it "class1.vb" (cause it's so unique!!)
3. change default code to read as such...
Namespace MySite
Public Class Functions
Public Shared Function WhatIsTodaysDate() As String
Return Date.Now.ToLongDateString
[code]....
Why is VS asking me to call the namespace twice if I use the "Imports" directive?I'm sure this has got something to do with VS2010 and the 4.0 framework.
In the code below, the namespace is called "Navigation" which I think is correct. Then I have a class called "Heading", which by definition is the direction a person/vehicle is truly pointing towards. I think that is also named correctly. In the code below, I have four things I have named:
_WhatToName1, WhatToName2, WhatToName3, and WhatToName4.
The value that gets passed in and stored is a double between 0 and 360 -- essentially the degree value from a circle. For WhatToName3 and WhatToName4, I have seen a lot of places that just use "value" as the name. Is that standard?
Namespace Navigation
Public Class Heading
Private _WhatToName1 As Double
Public Sub New(ByVal WhatToName3 As Double)
Me.WhatToName2 = WhatToName3
[Code] .....
I'm programatically looking ito a .aspx file and getting the file class name declared in its CodeBehind. For example, when analyzing myFile.aspx I read in its Page Directive and found its CodeBehind equals "myApplicationmyPage.aspx.vb". Then I use the code below:
[Code]....
I am attempting to move a highly referenced class from one namespace to another. Simply moving the file into the new project which has a different root namespace results in over 1100 errors throughout my solution.Some references to the class involve fully qualified namescape referencing and others involve the importing of the namespace.
I have tried using a refactoring tool (Refactor Pro) to rename the namespace, in the hope all references to the class would change, but this resulted in the aforementioned problem.Anyone have ideas of how to tackle this challenge without needing to drill into every file manually and changing the fully qualified namespace or importing the new one if it doesn't exist already?
-edit- nevermind i was lucky and didnt need to change much and have this test working.I am doing a quick test and i need to choose the full path to a function.in C# i can write namespace ABC { class DEF { static string Test() { return "A test"; } } } and can access it with ABC.DEF.Test() i tried
Namespace ABC
Partial Public Class DEF
Public Function Test(ByVal v As String) As String
[code]....
and i got VBTest.ABC.DEF.Test(). How do i get rid of VBTest which is the name of my project?
what websites, books or courses you guys suggest to use so I learn the fundamentals of programming. What is a class, method, namespace, private vs public. That leads me into .Net programming. A lot of intro to programming use java or C++ as the platform but I want to find one with VB.net or maybe C# if.
View 6 RepliesIn VB.net we are creating different namespace level classes. For Example,DynamicPDF - Root NameSpaceTest ,Report are two sub folders in side the sub folders some classes.
1) DynamicPDF.Test.ClassA
2) DynamicPDF.Test.Report.ClassB
using the VB.NET i was generated the Tlb file.
[code]....
I've wrote a class library in vb. it only has a class called MathEx. Now when i add a reference to a test project, i had to refer to the class as MathEx.MathEx is there anyway i could refer to the class as simply MathEx? (in other words i do not wish to have the default namespace added to my class libraries)
View 1 RepliesMe need use MultiLineStringEditor Class from System.Design namespace.I add reference as file (as in the .NET tab, it no) from
c:Program FilesReference AssembliesMicrosoftFramework.NETFrameworkv4.0System.Design.dll
and Visual Studio show in References
System.Design.dll
.NET
0.0.0.0
False
<The system cannot find the reference specified>
Is that possible to create a class in vb.net that is not in the default namespace of the project?
for example, say you have a project call sample1, then automatially IDE will have everything default to the Sample1 as your namespace root rather than under global, which is find for most case.but I want to create some classes that is directly under global namespace
I have a large web app in vb.net 4.0. Its default namespace is configured in its project properties. None of the root-level classes in our app are surrounded by namespace declarations. When I add a .asmx file to the root folder of the website, it compiles fine, but it doesn't work for some reason (already asked why in other topics). So to get it to work, I try to surround the class declared in the .asmx by a namespace declaration. As soon as I do this, I go from zero compiler errors to about a zillion. My app can't find ANYTHING in the root namespace. But I haven't changed any other files, only this .asmx file.
WHY is it behaving this way? How do I prevent it from behaving this way without refactoring the entire app? I would love to blank out the default namespace and add them explicitly around every root-level class, but I'm not sure that would fly with our release manager, and I don't even know if it would fix the problem.
I need to read an xml document from a database record into an XDocument object in order for it to be deserialized. So that the deserialization will work, I need to apply a specific namespace to each of the level 1 elements. So XML looks a bit like this:
[Code]...
How do I prevent the blank/empty namespace being added to each child element of the element to which the required namespace has been applied?
Imports System.Windows.Forms
ERROR : 'Namespace' can occur only at file or namespace level
The type or namespace name 'Messaging' does not exist in the namespace 'System' (are you missing an assembly reference?)
View 2 RepliesI need to create a namespace for my database class file, so I can call the database procedures within my webservice module. How can I create a namespace to call that Db class file?
View 1 RepliesThis class is located in the namespace Acme.Infrastructure.Interface.A class with the same name EventArgs exists in the System namespace.In another project in my solution I have a class Acme.BusinessModules.MyModule.MyClass.When attempting to use the EventArgs class I have to fully qualify the class name or the compiler thinks I am using the System.EventArgs class.My understanding of namespace resolution was that the compiler would first look for the class in the current namespace, and then its parents. It seems that the compiler checks in System before it checks in sibling namespaces. Is it correct that System is checked before the sibling? Or is this behaviour caused by other issues (Imports order?)?
View 1 RepliesI'm using SharpDevelop and .NET 4.0.
My question is this: If you start a new project with a "Windows Application" template, it generates a Program.vb with the following contents[code]...