Make Instances Of Classes "public"?

Aug 5, 2011

with one form and 1 class it is simple.but i have now 4 forms and 4 classfiles with 8 classes.i only need 1 commandlist with 20 commands i made them classes form 4 makes a private instance of the commandlist with the dim statement so i cant use it througout the projekt if i chance it in public , i get the reaction of visual studio i must replace it with dim (private) i read it is better to make instances ( dynamically)then to publicly share your classes(static)but i want my instances to be used by all forms and classes.

View 3 Replies


ADVERTISEMENT

Accessing Instances Of Classes

Jul 25, 2011

I am trying to make a pretty complicated, layered program.I have my main form which creates an instance of another form (addValue and myAddValue). From myAddValue I then want to access a few other classes to do various verification and other bits of code.Here though I have a problem.With the form ContactDetails, it just can't seem to read myAddValue.txtName or the others.If I try and read AddValue normally it says about it not being able to access a non-shared member (Expected that this doesn't work, it was just an attempt at something different)How do I read myAddValue from a class which isn't the one that created and isn't the one that it is an instance of?

View 3 Replies

Get Track Of All New Instances Of Classes

Jul 26, 2011

when i create a class ( ie ahuman ), i declare a object (ahuman) , i give it properties and with the properties i also can set the property ahuman , by creating the property ahuman (new) and set its variables, and declare its variables by declaring properties like weight, lenght, female or not.the problem for me is that i have multiple forms multiple class files , i cant oversee how to get track of all the new instances of classes.it is much easier to use pulbic shared properties to use a method in another class.

View 1 Replies

VS 2010 'Infinite' Public Instances Of A Class?

Jan 24, 2012

I'm a little out of my comfort zone here having programmed in VB6 quite a few years ago things have changed a lot since then.My issue is I have a class that I've built which works with no issues but I would like to be able to keep a 'handle' of some description on this class so I can also make adjustments to it's parameters when the user changes something. My problem is that I need to do this for an unknown quantity of these class instances.

In the VB.Net language how would I create an instance of this class that could be accessed by any Sub within the application and each instance created can be individually accessed by specifying some sort of identifier?

View 2 Replies

Using Instances Of Multiple Classes In Single File Without Recursive DB Calls?

Feb 3, 2011

2. FunctionLayer -deals with Common Operations which get results from DataLayer and return results to Forms.3. User - deals with User. (For Reusing the User Class in other projects, i have separated this class)Here in Class2 - I have an instance of Class1( ie., DataLayer) for DB Operations.imilarly in Class3- I have an instance of Class1( ie., DataLayer) for DB Operations.Now in my form, If i create Instance of Class2. But When I need user functionality in this form, I have to create an instance of Class3 to this form.

View 6 Replies

VS 2010 Public Variables For All Classes?

Mar 30, 2011

I have a MDI application and a very complicated class there which populates its properties from a dataset derived from an external database. Each form, including child forms have to be able to access that class and use its properties thorughout the whole session.I don't know where to 'preserve' these property values within the application. I kmow many books etc. suggest not to use public variables but I really can't find a way to solve this other than to use a public variable (which is a list(of my custom class) in this case.
I have a separate class called PublicItems.vb and declared there my public variable as

Public Shared secuniverse As List(Of myCustomClass)Is there something wrong with the syntax because if I try to use the variable secuniverse in my main application class, I get the following exception:'sectoruniverse' is not declared. It may be inaccessible due to its protection level.

View 7 Replies

Pass Data Between Subroutines And Functions Using Public Classes?

Oct 31, 2009

I would like an overview of System.EventArgs. I have an understanding of System.Object where I can pass data between subroutines and functions using Public Classes. I am curious what EventArgs do?

View 3 Replies

Take Some Existing Classes We Retrieve From A Web Service And Hiding Public Functions?

Nov 18, 2009

[code]...

EDIT: The above class is just an example of what could be returned from a web service. I won't have access to modify it at all, sorry if I didn't make that clear.Is it possible to somehow make a clone this class, so that it retains all of the properties values, but hides the fact that there is a Public function?I'd like to be able to take some existing classes we retrieve from a web service(which we didn't write) and be able to pass them on for use in an application, but without exposing the functions. I don't want to go down the route of creating my own classes that specifically define each property and write the values in (due to the sheer size of some of them), so I'm looking to see if there is anything dynamic I can utilise (maybe there is a way using reflection?).

View 4 Replies

Sockets - Winsock Replacement - Any Decent Public Classes With Events That Wrap The Socket Class?

Jan 25, 2011

I'm trying to update an application from vb6 to vb.net. The orig app used the winsock control. Unfortunately I can't nor do I want to use it in the re-write. Are there any decent public classes with events that wrap the Socket class?

View 1 Replies

Make A Collection Of Form Instances?

Nov 11, 2010

I am wanting to make a collection of form instances.I was wondering if the arrayList is a list of pointers (or references) to items added or if a new instance of an object is placed when using the add method.

i.e. if I had: Public Shared forms as Arraylist = new Arraylist Then if I called forms.add me from an instance of a form would it create a pointer or reference to the instance or generate a whole new one?

View 2 Replies

Make Own Classes In .net?

Jul 22, 2010

I've often wondered why would you need to make your own classes in vb.net? What purpose can they serve a typical application that cannot be already down without creating them?

View 2 Replies

Make A Public Array?

Nov 25, 2009

I'm trying to make a public array that I can use in Form1.vb and module1.vb.

It seems to work fine in Form1.vb but module1.vb complains about that it isn't declared.

This is how I've done it: I placed it right after this line in Form1.vb:

Public Class Form1
Public SuffixArray() As String

how I declare a Array that I can use in all forms and modules?

View 4 Replies

Attempting To Make A Form Public

Jul 12, 2011

I am attempting to make a form public. I've start out with this class:[code]I can see the stupid form thru intellisense, but when this code is run I'm getting a null reference exception. I believe this is because the stupid form has not been initialized. I thought that placing 'new' in my class definition would initialize the form.

View 4 Replies

How To Make A Class Instance Public

Aug 21, 2011

Is there any way to make a class instance public?In my mainform I define an instance of a certain class and then later on in some other forms which appear I want to alter this class.I try and pass them through when creating new instances of these other forms and it tells me Error3<instance of the class I want> cannot expose type <the class> outside the project through class <the form I want to edit it with>Which I gather from documentation is about it defeating the purpose to have a private class suddenly be thrown aroudn.but then how do I make it public? I can't define it in the first place as public myXClass as XClass, it only accepts private.

View 6 Replies

Make A Dataset From Private To Public?

Jul 5, 2011

basically how do I make my dataset public so I can access it on another form.

Dim ds As New DataSet("Dataset1")
Dim filePath As String
OpenFileDialog1.ShowDialog()
filePath = OpenFileDialog1.FileName
ds.ReadXmlSchema(filePath)

[Code]...

View 2 Replies

Make A Property Public Get But Private Set?

Apr 25, 2009

I just stumbled over this in some C# code...:public Foo Foo { get; private set; }

View 2 Replies

Make A Variable Public To All Forms Within The Application?

Jun 9, 2011

how to make a variable public to all forms within the application.Eg

Public MyPath = "C:"

can do for one form but not all

View 3 Replies

Make Do Public Sub/functions While Accessing Excel?

May 27, 2009

I was thinking about writing some VB 2005 code that would be able to open an excel file and keep it open while I do things in separate functions/subs basically just check boxes, so each check box is its own sub but HOW do I do that with out opening and closing the excel file for every check box sub, since every time I make a check box the sub comes up as private?

View 9 Replies

Exactly Do Classes Make Programming Eaiser?

Apr 16, 2012

So i learned about classes today and i am totally confused about them. How exactly do they make programming life eaiser? I though Functions and Sub Procedures were making my programming life easier

View 4 Replies

C# : Make A Jagged String Array A Public Property?

Mar 28, 2011

Public Property TabsCollection()() as String()()
Get
Return _tabsCollection
End Get

[code]....

but it errors saying: End of statement expected.

View 3 Replies

Make A Control That Exposes Its Protected Properties To The Public?

Jan 30, 2010

ok basically i was trying to make a Control that exposes its protected properties to the public. example, you could call the protected DoubleBuffered property publicly. the problem is that this class called ExposedControl must be compatible with the type System.Windows.Forms.Control, meaning i should be able to create an ExposedControl using an existing Control so i had something like this in the constructor.

Public Sub New(ByVal control as Control) Me = control

[Code]...

View 8 Replies

Make Constructor Public And Allow Anybody To Create An Instance Of Class?

Apr 6, 2009

I have a class inside a class.I need to expose the properties of the 2nd class to other classes, therefore it is public.However, I do not wish other classes to be able to create instances of this 2nd class, it should only be instantitated from its parent class.I thought I could resolve this issue by making the constructor of the 2nd class private, but this even prevents the parent class from instantiating its child class! How can I work around this, do I have to make the constructor public and allow anybody to create an instance of the class?

View 3 Replies

Make Base Interface For Generic Classes?

May 25, 2010

I'm trying to create a base interface for a class of mine that uses generics. However, I cannot figure out how to declare a property of the interface when its type won't be defined until the class is initialized.

To clarify, consider List(of T), which according to msdn, implements IList (among other things). Note that IList is not the same as its generic counterpart IList(Of T). So that mean any List(of T) can be converted to IList, which simply returns an object for its items. That's what I want to do with MyClass(of T), be able to cast it as IMyClass regardless of what T is.

But when I try such as:

Interface IMyClass
Prop A as Object
Class MyClass(of T) Implements IMyClass
Prop A as T Implements IMyClass.A

I get a signature error for the last line, even though object is broader than T. What am I doing wrong, or how exactly did Microsoft manage to make List(of T) implement IList?

View 9 Replies

Make Classes/Modules/arrays And Objects?

May 18, 2010

This probably sounds daft, but im struggling to get to grips with Classes/Modules/arrays and objects, as well as there uses and what they are, and yes im still coding some how i hear you cry.The reason i ask is because Ive got a load of Dim's in my program that are the same giving locations of files and folders and wondered can they be used as a module that i can alter after the program is built, incase of folder locations being wrong or moved, manually correct after install.

View 1 Replies

Make Subroutines / Properties Inactive In Classes?

May 27, 2010

I am working on a bitmap class module in Visual Basic 2010 that has an option to create a graphic grid on the bitmap.

[code]...

View 3 Replies

Using Partial Classes To Make Two Equivalent Codebehind Pages In VB

Jun 15, 2012

We are using T4 to generate our .aspx and .vb files. Everything works well - but we often have to customize behavior on the pages. However, we also occasionally have to regenerate pages - which has the potential to wipe out work which would otherwise still be valid. I would like a setup like this:

Default.aspx 'which would contain the controls
Default.aspx.vb 'which would bind, load and save data
Default.behaviour.vb '(or something like that) - which would store the behavior

With both the pages being able to reference the controls. Is that at all possible? [Code]

View 1 Replies

VS 2010 Make Classes Import Into Main Form.vb

Mar 20, 2012

I was just wondering how you can make classes import into your main Form.vb

Let's say I make a class with the following.

Public Class OtherStuff
Public Sub HideMe()
Form1.Hide()

[Code]....

How could I make the Form1.vb include the things that are in OtherStuff.vb.

All of the solutions that I have tried come up with the same error. Reference to a non-shared member requires an object reference.

View 2 Replies

VS 2005 - How To Make Custom Base Classes Available To Future Programs

Oct 22, 2010

I have written multiple programs in the past that deal with cad data. Points, lines, arcs, etc. For each program I ended up creating slightly different versions of some really base classes like a class that defines a point:

<Serializable()> Public Class Point
Public x As Double = 0
Public y As Double = 0
Public z As Double = 0
End Class

My question is how would I use that class in such a way that it could be in a namespace and imported into any future project that I write?

View 2 Replies

Asp.net - Access A Module Or A Public Class With Public Shared Members From Inline Vb Code <% .. %>?

Feb 10, 2011

I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.

View 2 Replies

Declare A Public Param For Public Class Form1?

Apr 7, 2011

Imports System
Imports System.Threading
Imports System.ComponentModel[code]....

how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved