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


ADVERTISEMENT

VS 2010 Converting Public Class To Class With Get And Set?

Nov 30, 2011

I need to convert the following code, so that it exists as a created class "Payroll" that utilizes "Get" and "Set" elements. Unfortunately, I'm completely lost.

Public Class frmPayroll
Private Sub frmPayroll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code].....

View 2 Replies

VS 2010 Sorting A Listbox (after Trying To Copy Class Instances Properties To A Temp List)

Jan 25, 2012

I'm trying to figure out a way to sort the entries of a listbox... but in a different way instead of the obvious one (sorted property). First of all, I need to explain how the items are populated at first:

[Code]...

View 19 Replies

VS 2010 Public Class A(of A)?

Jul 22, 2010

Public MustInherit Class SingleInstanceForm(Of T As SingleInstanceForm)
Inherits Form
End Class

[code]...

View 6 Replies

VS 2010 Class Public Property Or Sub/Function?

Jul 13, 2011

I was wondering if someone could explain to me the differences between these 2 ways of accessing a class property.Access Way : 1 (To me this looks like im declaring the property of the class as a Global variable which can be changed anywhere

[Code]...

View 6 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

Defining A Class For Multiple Child Class Instances?

Feb 10, 2011

I have created a class for a Sports Facility. A facility has a Name, Status, Notes, etc as members of the class. This works well, I can create a new instance of an exisitng Sports Facility from the database, create a new instance, etc. All working well.What I am stuck on is accessing a list of Sports Facilities. I know I can create a new list by doing

Dim List As New List(Of Facility)

For Each fRow As DataRow In ds.Tables("Facilities").Rows

List.Add(New Facility(fRow.Item("FacilityID"))

Next

View 4 Replies

Unable To Use An Instance Of The Nested Class Through A Public Variable Of The Parent Class?

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

Can't Make Difference Between Public Class And Private Class And Friend And Protected Friend Class

May 15, 2009

I can't make difference between public class and private class and friend and protected friend class.

View 1 Replies

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

Multiple Instances Of Class?

Mar 29, 2010

I have the following problem. (VB.Net 2008)I have created a class (myFirstClass). In this class there are a lot of calculations being made wich gets fired by events in that same class.Now i want that same class to be able to fire more instances of itself. However i noticed that each time i fire an event from a Sub the program waits till the event is finished before going to the next line of code. This is a problem since i want the event wich fires a new instance of the class to fire it and forget about it.

View 7 Replies

Declare An Internal Class Within A Public Class?

Nov 17, 2008

how to declare an internal class within a public class using vb.net?

View 2 Replies

Private And Public Class At Class Library

Mar 12, 2011

I'm posting this there is a relationship with my previous post [URL]

I have two projects, namely:

1. Project1 (Windows Application)

2. Project2 (Class Library)

in Project2 there are several classes:

* frmLogin.vb
* frmCustomer.vb
* clsGlobals.vb

in my case, I want to frmLogin.vb and frmCustomer.vb not called in Project1 and I can only call is clsGlobals.vb

View 8 Replies

.net - Allow Math To Occur On Instances Of Class?

Nov 27, 2010

Is there some interface I can implement to allow basic comparisons and math to happen as it would an integer?

For example, let's say I have the following class:

Public Class Something
Public SomeBigNumber as UInt64
End Class

I would like to do something like this:

Dim SomethingA, SomethingB, SomethingC as New Something
....
If (SomethingA-SomethingB) > SomethingC Then
'Do stuff
End If

I was hoping to be able to implement some interface (if that is even the right term for it) that would return the UInt64 contained in the class for comparison and math, if possible.

View 1 Replies

Added To Each UserControl (different Instances Of The Same Class), A Little Map?

Apr 28, 2009

I have a form whose purpose is to let the user to load map files.The form may manage a variable classes of maps, and each class have his own UserControl.To make it more user friendly, I added to each UserControl (different instances of the same class), a little map, showing a small picture of the map, and some data, as bound coordinates.

The problem is, that it looks really ugly. The maps are so big, compared with the rest of the UserControl (who contains just a button and a textbox to search for files).I wish to fix it, but I din not see an elegant way to include the pictures and info.I attach a form screen capture with two UserControl.I would like to get some tips for more experienced users. There are some guidelines?

View 5 Replies

Creating Instances Of Own Class At Runtime?

Sep 3, 2011

info on creating instances of my own class at runtime. Simple project for family recipes but would like the option to add new recipes with new instances of my own food Item class at runtime. Creating my own class,no problem. Storing the data in an XML file, OK on that as well. My issue is creating new instances of different food item class as I use this program over time

View 13 Replies

Multiple Instances Of A Custom Class?

Feb 15, 2009

I have a sub that runs on a button click which I want to create a new instance of a custom class and add it to a list of already created instances of this class. I want the result to be a List Of collection of all of my class instances.

My problem is that each time I run the sub, it simply 'overwrites' the first instance of the class and adds a copy of it to the list instead of writing a new instance. My code is along these lines

dim objFixture as new clsFixture
For n As Integer = 1 To intNoOfChannels
objFixture.SetChannelAddress(n, intCurrentChannelTotal + 1)
intCurrentChannelTotal += 1
next
lstFixtures.Add(objFixture)

View 7 Replies

Passing Variables Between Instances Of A Class

Jun 17, 2009

I created a program a while back, in the traditional VB.NET way by drawing a bunch of forms. I have started playing around with creating the forms at runtime using classes. I have a placeholder form called frmStartup which merely calls the CreateLogin() sub from the CreateFormClass. The CreateLogin() sub creates a new blank form, then calls the grpbxLogin(), btnSave() and btnExit() subs from the FormElementClass which adds all the buttons and textboxes to the form. Within the FormElementClass, I have associated btnSave and btnExit with event handlers. These even handlers call subs from the DataProcessingClass. The event handler for Exit works just fine.I am having a problem with the Save event handler. Precisely, I don't know how to pass either the username or password from the Login form to the btnLogin_Click() sub in the DataProcessingForm. I have tried using Me. and frmLogin., but the program doesn't see either of those. If the Login form is an instance that is disposed of once another Sub is called, then it won't exist later on to call from. I have tried declaring variables and passing those along to btnLogin_Click, but no matter where I put it, the program doesn't see txtbxUsername.Text or txtbxPassword.Text. Not even from within FormElementsClass, which is were the boxes are created.Any ideas on how to pass variables in this case? I am not even sure what you would call this such as passing between classes, or passing between instances.[code]

View 9 Replies

Repor Declaring Class Instances?

Oct 20, 2008

I've decided to forget the d@mned custom code because everything I do with comes up with errors I don't know how to fix and it seems no one else does either. Or they do and they're keeping to themselves.

I put the functions that I needed to use in a class called MsgBoxOperations. The file name is MsgBoxOperations.vb In the report, up on the standard bar where file, edit, view, and all the other stuff is, is one that says report. You click that and go to report properties and it brings up where you can name the report and put in custom code...(hate custom code right now...) and where you can put references and class instances. Clicking on the Reference tab brings up wher you put in your references and classes.

In the classes area it asks for the Class Name, which I put in MsgBoxOperations, and the instance name of that class, this case mbo. I get that far and put in those two things and save it. Then I go to the textboxes where the values need to be. I put in the text box: =Code.mbo.GetStartDate

I've already tried taking the Code. part out and it screams that mbo isn't declared. So it does have to be there. I go to run the code and comes up with this error: QuoteError in class instance declaration for class MsgBoxOperations: [BC30002] Type 'MsgBoxOperations' is not defined.

I've posted before and still have received no help or someone tried to help but then stopped when their suggestion failed and then no one else wanted to help. I've googled this problem to the point where every link that it comes up with I have already clicked and found their information useless. I've got a freaking migraine because of this issue and have been in tears over it more than once.

View 14 Replies

Alphabetize An Array Of Objects That Are Instances Of A Class?

Nov 1, 2011

I have an array of objects 2000 that are instances of a class. I want to alphebatise these objects by a detail of the class.

View 1 Replies

C# - Respond To Events From A List Of Class Instances?

Jan 21, 2011

I have a .NET class, InstrumentConnector, that has an event, StatusChanged. I want to create several instances of this class (each class handles a separate file) and respond when the StatusChanged event is raised any instance. How would I do this in .NET? Do I want to create a List(Of InstrumentConnector) or a similar IEnumerable? How do I write the event handler to respond to a particular instance's StatusChanged event?

Here is the InstrumentConnector class and the module with the StatusChanged handler:

Public Class InstrumentConnector
Private _inProcessDir As String
Private _doneDir As String

[Code].....

View 2 Replies

Creating Instances Of A Class That Has Several Readonly Properties?

May 24, 2011

What is an elegant way to create and initialise instances of a class that has several readonly properties? Passing all values in a constructor would not be very convenient.

The purpose is that instances are immutable after initialisation. However if the constructor is not used for initialising all the property values, then how can the readonly properties be changed from another class?

View 2 Replies

Creating An Array Of Instances Where Instance Could Be Base Or Sub Class?

Oct 31, 2011

I have a class structure and am attempting to create an array of object instances from the class some instances are parents and some are children Code snippets,

Parent Class object
Option Strict On
Option Explicit On
Public Class cTransportItem

[code]....

View 1 Replies

Ensure Instances Of Class Finish Before Main Terminates?

Feb 14, 2012

I have a MultiThreading issue and conceptual question using Visual Basic (but it applies to almost all languages). [code]...

View 2 Replies

MovablePictureBox - Set The Flags In All Other Existing Instances Of The Class, When It Is Set To True In The Selected PictureBox?

Apr 17, 2010

if I have several of these movable PictureBoxes added to a Form (Form1) and want to display a selection rectangle only on that PictureBox, that is just selected,then I think I should use a flag to mark whether a PictureBox is selected or not. The flag could be used in paint event to decide,whether the selection rectangle is to be drawn or no .To add a flag property to the new class is no problem. But how can I set the flags in all other existing instances of the class, when it is set to True in the selected PictureBox?

View 1 Replies

Object Oreinted Random Failure - Define Two Instances Of Class And Configure ?

Oct 27, 2009

I am having a problem with a and OOP class i made that contains a sub that creates random integers.

Problem is if i define two instances of this class and configure them(name in this case) then they both display different names but the random integers are ALWAY the same. in this case having the integers the same kinda kills the idea of the program.

Is it possible that the random part only every works for one class, but if .NET is fully OOP then this should not be possible... right?

Some of my Code (broken down to something smaller) i will display for obvious reasons.

Code:

View 11 Replies

.net - Using A Class Like A Public Variable In Asp.net?

Apr 13, 2009

I'm getting an error in .net when trying to declare a Public class on my code behind page.

Partial Class _Default Inherits System.Web.UI.Page

Public someVariable as integer
Public someClass as className

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...]

The error I'm getting is BC30508: 'someClass' cannot expose type 'className' in namespace '<Default>' through class '_Default'.The goal here is accessing the class properties in script blocks on the aspx page like this <%=someClass.classProperty%>

I'm not sure if I'm trying the right methods (I've tried several ways of declaring the public class) or if it can even be done..

View 3 Replies

Call A Public Sub Within A Class

Nov 27, 2011

i am trying to call a public sub within a class that resides within my form1 code:

[Code]...

View 1 Replies

Class Of Public Const?

Jan 13, 2011

I am making a program where there is a number of strings are needs and they need to be pre-defined. I rather not store it all in a XML file as I don't want anyone going in and altering them.

Has anyone ever created a class of public constants just to make cleaner code or is it considered bad practice?

View 5 Replies







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