A Class Instance To Be Used "worldwide" In The Project
Aug 8, 2011
my solution is make a class and public share this class as new in the class itself. it is a class to be filled with constants.
is there any programmatical objection against this solution ?
View 1 Replies
ADVERTISEMENT
Feb 19, 2009
I'm creating what I believe is an mdi app.I have a login form.I have a class for security.My login form creates an instance of the security class. There are all kinds of security parameters for each user (permissions to different things, etc.)These parameters are part of my security class.Once the user logs in, many other forms will all be opened and closed within the main mdi frame.All of these other forms need the information of the security class to know what the user has permission to do.Do I have to create a new instance of security class for every form in my project? Isn't there a way to store this stuff globally somehow. Retrieve once from the db at the start of the app during login and just get it from this global area everytime?
View 2 Replies
Aug 7, 2009
I am writing a class project application that is loadable from within AutoCAD. This application generates an Excel workbook with extracted data. I am having a problem with Excel closing when finished. It seems the Excel instance hangs until my application is unloaded. I have found the section of code that seems to be causing to hang, but I'm not sure why its hanging to prevent it.
Below is a copy of my code for the class (top to bottom with exception of the FileExistValidation method... too many characters ). The code section that is commented out seems to be what is causing it to hang. If I uncomment that, Excel hangs, with it commented out, Excel closes out in the background.[code]...
View 10 Replies
Jun 7, 2012
I want to created a nested class that can only be visible to and instantiated from the parent class.But I also want to be able to use an instance of the nested class through a public variable of the parent class.I tried making the nested class private, or making the nested class' constructor private, but it won't compile.Is it possible to do this in .NET?
[Code]...
View 3 Replies
Jan 18, 2011
my proble is the following: I have a class MyClass and another class Modifier, which has a method ModifyMyClass(ByRef mc as MyClass) that receives a MyClass instance as ByRef parameter to modify it. A smell of the code is:
[Code]...
View 4 Replies
Aug 19, 2009
I have a class in which some of the fields are also classes.I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"But the code compiles fine.
dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error
How can i fix this ?
View 6 Replies
Aug 19, 2009
I have a class in which some of the fields are also classes.
I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"
But the code compiles fine.
dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error
View 4 Replies
May 6, 2010
If you run this code you will see that the 500 PictureBoxes that are added ( this is easier to show than adding pixels as a pixel is only a single point ) fall mainly on the diagonal.With regard the RANDOM class, why should this be like this when the bounds of the instances are? >>
p.Location = New Point(x.Next(0, Me.Width + 1
), y.Next(0, Me.Height + 1 ))
as in this code.>>
[code].....-2138214fdeb4
View 9 Replies
May 18, 2010
I've createda vb.net class library where I've defined a number of small classes... nothing complicated, just working with strings, sending emails, etc.In another project, I reference the class library and I'm seemingly able to create an instance ofone of tclasses - intellisense shows me all of the plic properties, methods, etc... all looks perfect. No compile errors at all, nothing b gumdropsand lollipops.When I run the app I'm working on that references the class library, it fails at the point where I'm creating an instance of the class and gives me a vague exception, "System.TypeLoadException".
View 2 Replies
Jan 20, 2012
Is there a way to define a class such that there can be only a single instance of that class?
View 5 Replies
May 20, 2010
I need to create a new instance of a class that needs a member of the calling class. But i can't pass a reference to the calling class through the constructor.The solution i am looking for is something like this:
Public Class ChildClass
Public Sub New(args)
_MyMember = GetMemberFromCallingClass()
[code]....
I want this to work without having to manually pass any references or variables from the calling class to the new instance of ChildClass.
View 2 Replies
Jun 11, 2012
I want to create a class that will "search" for something. Basically I load up the "search item" when the class is created and inside the class is logic to do the "search". The result of this logic will be more "searches" that I want to start. How can I have the logic in the class create another instance of the class itself?
View 3 Replies
Jun 28, 2011
There are 3 project in vb.net MAIN PROJECT, BLL(Business Logic Layer), DAL(Data Access Layer) now we are trying to maintain one single instance of some values through out the assembly or what we can called single instance should get used in all projects...for example there is a class called clsParameter we need only one instance of this class should get used through out all projects so if i made any change in MAIN PROJECT same values also get updated in BLL or BLL should receive same values....
View 3 Replies
Nov 18, 2009
is it possible to use a dll in my project without having to create an instance of the dll? for example I have a dll that has three basic math functions:
[Code]...
View 18 Replies
Aug 20, 2010
Is there a way to get the instance's class name with VB.NET?
View 2 Replies
Apr 18, 2012
In my VB .Net code, I am trying to create to launch MS Project Application. Dim prjApp As Microsoft.Office.Interop.MSProject.Application = New Microsoft.Office.Interop.MSProject.Application
But I am getting the exception as follows:
"Creating an instance of the COM component with CSSID {36D27C48-A1E8-11D3-BA55-00C04F72F325} from the
IClassFactory failed due to the following error: 80010001".Note: This exception happens in 64 bit Windows 7 German OS. But the same code runs successfully in 32 bit Win XP (German and English) and 64 bit Windows 7 English OS.I have even tried the following steps in German 64 bit Win 7
1. Running the application in Administrator mode
2. Setting UAC to low.
3. Re-installing MS Project in German 64 bit Win 7.
View 1 Replies
Jul 16, 2009
I have been asked by a code snippet to add the instance of class that contains data i want to add to an XML file, the only trouble is i am not sure what an instance of class is. Is it something that looks like this: [Code]
View 2 Replies
Feb 24, 2010
I am working on an ASP.Net 3.5 solution that I did not originally build. I added a class file named Incident.vb to the App_Code folder like I always do.But in my code behind of a web page, I usually create an instance of a class like:
Dim oIncident as New Incident
But after I type "New", normally I would see my class file he intellisense but I do not. So it does not seem to be able to find Incident.vb. I have not seen this behavior before. Trust me, my class is correct. I have created many class files like this.[code]...
View 9 Replies
Sep 11, 2009
I think I just need a push in the right direction. I cannot seem to get my sub from an instance of my class, once instantiated, to run when I click on the button. My Code in the class is
When I click this:Private Sub btnBark_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBark.Click
mydawg.bark()
End Sub
[Code]...
View 2 Replies
Mar 24, 2012
I have a Class, which I create an instance of in order to use, however I have a couple of functions (which don't really relate to the instance data) which I want to use when an instance hasn't been created.
Visual Basic .NET (2010)
Example of what I'm trying to do:
' Log a user into the system (this works)
Dim hedwig As New CustomSecurity
hedwig.Login("username", "password")
[Code].....
View 3 Replies
Jun 6, 2011
this used to be so easy in C++ and VB6 I am dynamically creating multiple instances of a fairly simple class, tracking them via the Collections class in vb.net. I loop through the collection if I need to get to a particular instance to set some property, for example. Everything is fine, and works ok until I try to destroy the instances that I created (largely because I am probably not doing it right). What I am doing setting the instance to "nothing". That is, here is the portion of the code:
[Code]...
View 1 Replies
Feb 1, 2011
I have a class "Character" that holds character stats and skills. I make a new instance of it "MyCharacter". The problem is I would like to use it like this.
MyCharacter.stat.charactername ="whatever"
Where stat is another class within Character or
MyCharacter.skill.lockpick=10, b
But I can't seem to do it.
View 3 Replies
May 10, 2009
Lets Say you have a Class
Public Class ExampleClass
Private _Name As String = "Unnamed"
Private _Value As Object = Nothing
[code].....
View 1 Replies
Feb 17, 2012
In a program that I'm putting together, I have a small class and in the program, I add instances of that class to a List(Of [that class]).Later in the program I test whether or not that list contains a particular instance of the class, but it fails to return true when I've proven that it's in there. I've since set up an iteration routine where it finds it, but it has me puzzled why the ".Contains" will not locate it.
My question is simple: When I have a List where I add an instance of a structure or class, does it not actually examine the contents of the structure or class inside it?
View 5 Replies
Apr 16, 2010
how to set string content as a class instance name?Example. I have an INI-class with many instances like .Path, .Width, etc. Now, i'm reading my ini-file string by string wich hase been written by template:
[code...]
I would like to automate reading an assignment at ONCE. Like cutting the first word in line and setup it as my INI-class instance name.I know how to cut first word, but have no idea, how to set this string as instance name.
View 14 Replies
May 22, 2009
Consider the following mock-up image I've created:I am new with working with InfoPath and I was curious if anyone knows how to embed an instance of InfoPath inside of a winform, so users can fill out the form without launching the InfoPath application.
View 2 Replies
Sep 29, 2011
my aim is to create a new instance box at the push of a button, the box has strings name and Id to be filled concatenating the auto generated ID i.e. 0 to 210 plus a string "Box" added by the user. I had problems earlier creating a structure within the class box, frankly I am not sure if the code below will work, as i try to run it in VB I get an error indicating that I am using the variables strBoxPositions() and strBoxNumbers() without assigning a value to it. The thing is the strBoxPositions() should automatically be filled by arrPosition() which will be created at the same time the new object box is created and the strNumbers() will be created with empty strings to be filled at latter stage by the used as and when necessary.
how could I initialise those arrays to get the program to run and perhaps ill be able to see if the code works or not, or just correct this code with a better way of code with comments, also if possible some indication on how could I update the strNumbers array inputing the strings one at a time on a text box field.
Public class form1
Public Class Box
Public intBoxID As Integer
[Code].....
View 2 Replies
Nov 12, 2010
i have
VariableA as Class1
Variable1 as string
Variable1 = "VariableA"
I want to be able to use Variable1 to get access to VariableA(?).
So i want to able to do something like
VariableA.Property1 = "test"
But like this:
Variable1.Property1 = "test"
View 5 Replies
Jan 15, 2011
Am a geriatric coming back to programming after a decade's rest. Keeping it very simple. An empty form. As the form loads, create a Black button (OK) and also create a class which itself creates a single Cyan button. Am using VB 2010 Express. When I run, it creates the Black Button but not the Cyan (i.e. the one that is generated by the class).
[Code]....
View 11 Replies
Aug 3, 2011
Do I have to instantiate description every time for different method? Or should I use static? Here's how I'm doing this now: What is the best way of handling this kind of situations. it seems that I repeat this line:Dim description As BLLDescription = New BLLDescription() without any good reasn.
Protected Sub Button8_Click(sender As Object, e As System.EventArgs) Handles Button8.Click
Dim description As BLLDescription = New BLLDescription()
[Cdoe].....
View 2 Replies