VS 2008 Class Multiple New Subs?

Apr 10, 2011

I want to create constructor that can create container with these properties:

1. Only Diameter, in new sub define it round shape.

2. Diameter and Volume.

3. Length and Width (for rectangle shape)

All are double data type, but problem is 2 and 3 are conflict.How to let program know I want to create round shape container or rectangular shape container?

[Code]...

View 16 Replies


ADVERTISEMENT

VS 2008 Class Library - Declare New Instance Of MainClass() Before Using Subs/Functions In Class2 Or Class3?

Feb 3, 2011

Namespace MyClassLib
Public Class MainClass
Public Sub New()

[CODE]...

Is it possible to make it so that the user using the Class Library has to declare a new Instance of MainClass() before using Subs/Functions in Class2 or Class3?

View 2 Replies

Run Multiple Subs At Once?

Feb 7, 2012

I'm working on my program and I have 10 subs that grab 10 files and format them. Is it possible to run more than one sub at once? I tried to google it but there doesn't seem to be much available... If anyone could just point me in the right direction, that would be awesome!!

[Code]...

View 2 Replies

Should All Subs & Functions Always Be Inside A Class

Oct 4, 2008

This is very basic about the layout of classes, subs etc. 1. Should all my subs & functions always be inside a class? I haven't used classes too much before, mostly just a bunch of subs in a form file. Now I downloaded a sample program which I want to develop. This has all the code of the form inside "Public Class Form1": [Code] The code is an example of use of the ZedGraph library. It produce a simple window with one graph/chart. Now I want to develop this code with several tabs, a dusin different charts, file I/O and so on. I'm ok with most of the specific coding, but my question is on the general coding;

2. Should I continue my subs&functions inside this form? inside this class? inside a new class? Earlier when I've NOT been using class, I can make global variables by placing the "Dim" outside the subs. This does not seem to work within a class. 3. Should I avoid global variables all together, or how is this done without always passing arguments?

Also I will make more forms, for program options etc. 4. Should these forms be coded as classes? or just subs&functions in a form? Obviously I'm not well trained on the proper use of classes and have trouble to find this easily explained.

View 2 Replies

Create A .dll In VB Express With Multiple Functions And Subs?

Apr 15, 2010

I'm trying to create a .dll in VB Express with multiple functions and subs.

For the .dll program, I create a class module with:
Public Class Class1
Public Function ReturnOne(ByRef MyVar As Integer) As Integer

[Code]....

Upon execution, it tells me that it cannot find the entry point in the .dll.

View 4 Replies

VS 2010 - Creating Multiple Instances Of Subs

Jul 31, 2011

I'm creating a twitter account manager using the Twitter API. I have multiple accounts, over 10 of them. I want to automate all 10 of these accounts to do certain things, now the way I started to code the program was so that it would accommodate only one account, and all the codes worked perfectly and were managed by individual timers for individual processes that I wanted done. i could tweet between certain intervals, follow people who tweet certain things without me being on top of it.

Now the problem is that I've been trying to create new instances of subs that I've already created so that I dont have to create 10 new subs with the exact same procedures. I'm pretty sure it's impossible to create copies of subs dynamically or within a loop but it didn't stop me from trying. So question is how can I edit a program that was designed to accommodate and automate only one account, to potentially accommodate over a 100? I don't need codes or anything I need ideas so I can try them, but right now I'm completely blank.

View 2 Replies

Passing Subs And Functions With Varying Signatures Into A Class

Dec 28, 2011

I have a number of unrelated subs and functions that do various things on my server (e.g. Lighting control, data caching, server maintenance, etc). They are all in various classes which I have coalesced into a single solution.My goal is to create a single, simple interface which each of these disparate classes can be integrated and called from a command line interface. Instead of hard-coding a longish case statement which parses arguments and passes them to the various subs, I wanted to make a generic class which can be instantiated with a minimum of information and put into a data structure. Ideally, adding a new function would involve:

1.) Providing the function pointer (Delegate). The delegates will have various signatures. This is the crux of the question.

2.) Providing ancillary info such as the command-line callable name, number of arguments, argument types, etc.

I have a 100% working class called "node" which is basically a hierarchical tree of node instances. I can use this to simply organize function calls in related branches. All is working quite well.NodeFunctionDelegate(ByVal args As String) As String.The node takes the arguments passed to it by the command line and sends it as the "args" string as comma-separated. The delegate function then needs to know how to split up these comma-separated values, type them, tryparse them and etc. It then must return some string.It works, but it involves writing a middle-man function stub which can receive the argument string from the node class, do the parsing and type checking, and then call the destination function.My goal is to eliminate this trivial middle-man function. The problem is, I can't figure out how to create a variable-signature delegate for the node class.

View 9 Replies

VS 2008 Overriding Subs

Jan 7, 2010

I have an access database for steel members. Each table has a different type of member, and then in those tables, each size of that member type.

I am about to create a tool that draws these sections when they are selected, but as there are 12 different member types, I don't really want to have 12 different Subs for "Draw" that essentially do the same thing.

I considered polymorphism.. (I think I have it correct)

[code...]

View 1 Replies

VS 2008 Combining Private Subs Together?

Nov 5, 2010

Probably an easy question to answer...I have 9 buttons on my form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
etc. and all do the same thing so how can I merge them into the same sub so i don't have to copy and paste a bunch?

View 4 Replies

VS 2008 - BackgroundWorker Call Additional Subs?

Jul 7, 2009

Can a BackgroundWorker call additional subs? In my program I am connectiong to an OPC Server. I am doing some AsynReads, which in themselves don't take anytime. But Once I get the AsyncReadComplete returned, I want to do the AsyncRead right away. Basically I need to Loop them. The problem now is that while it is doing this, Everything is unresponsive, because it is just going through the loop. So to perhaps rephrase the question, If the BackgroundWorker initiates a process (in this case AsyncRed) would the returned AsyncReadComplete be apart of the BackgroundWorker or seperate Thread?

View 7 Replies

VS 2008 Pass An Array Between Private Subs?

Sep 4, 2009

I want to use a string array created in a different private sub in another, so I need to pass the array. How do I accomplish this task?

View 2 Replies

VS 2008 Data In A Variable Not Transmitting Between Public Subs?

Nov 17, 2009

Basicly I have a set of public subs, (not related to a form), inside a public class, and all of them share a variable. One of the subs, the one called for first gives the variable a value.

When the next sub is called, the variable is null. The data in the variable has been erased as the execution of the prior public sub ended I'm guessing.

View 7 Replies

VS 2008 Subs/Functions Intellisense Listing Values To Parameters Upon Using It

May 30, 2010

I'm almost sure that I've seen this somewhere, but I can't find it anymore. Or maybe I'm imagining it, which would'nt be strange either.

When creating a sub or function and adding parameters used when calling it.

-Is it possible to list the parameters that I can enter when using it somewhere in my code?

E.g.

Public Sub MessageMain(ByVal Message As String, ByVal MessageType As String (List of possible values for MessageType)) Same for example as when you have boolean values in a sub/function. As soon as you use that somewhere in your code intellisense will present you with True/False to select.

I'd like the same for parameters in subs or functions I create and calling them from somewhere in my code. Saves me the trouble of remembering which options are available for those parameters.

View 8 Replies

VS 2008 - Difference Between Public, Private, Protected When Declaring Functions And Subs?

Jul 19, 2009

i have have a few questions about the syntax of the lan.:

1) What is the 'Get' statement and when do you use it?

2) Whats the difference between public, private, protected etc... when declaring functions and subs.

3) When would you use the overrides property?

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

Calling Private Subs In Another Private Subs?

Jun 15, 2009

I'm trying to call a private sub in another private sub. For example ;

[Code]....

View 13 Replies

VS 2010 Add Subs / Functions To Subs / Functions?

Oct 26, 2009

When you refrence a Function like this one:[code]You may want to be able to get more out of that, like this.[code]So how would I be able to add subs or functions onto a sub or function like that?

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

.net - Update From From Multiple Threads Of The Same Class?

May 31, 2012

I have this class and I have a loop that launches multiple threads from the same class. This is all done from the main form.Now I want to update the richtextbox on the main from these classes.I have tried those begininvokes etc etc and nothing worked, no error but no output as well.Here the code for launching the threads :

Private PingObjects(100000) As Account 'Account is the class and login is the sub in it...
PingObjects(I) = New Account
Threads(I) = New Threading.Thread(AddressOf PingObjects(I).login)

[code]....

And to update the rtb, im using MainForm.log.text = "....." Nothing happens, no error.I have tried using the begin invoker method as well.

View 2 Replies

C# - .NET Multiple Namespaces For Single Class

Sep 27, 2010

Is it possible to have a single class reside within two name-spaces and how can I do this?

To clarify: We have a class library (let say root namespace is classLib1), which has grown over time (more classes) and I want to logically group classes into different namespaces. However some of the older classes need to be grouped into these new namespaces (e.g classLib1.section1) and doing so will break legacy code in other assemblys that use this class library. So I want to be able to refer to a class using both name-spaces until we can phase the old ones out.

I can't find any information on this, which suggests there is a reason that people would not want to do this!?!

View 3 Replies

Class Module For Multiple Buttons?

Jul 13, 2011

When loading the buttons to the class I keep getting the 'Null Reference Exception was unhandled' error. How can I fix it? Here is the code...

Class Module:

Public Class Buttons_Group_Class
Public WithEvents Button_Group As System.Windows.Forms.Button
Sub Button_Group_Click()

[code]....

View 7 Replies

How To Apply Class To Multiple PictureBoxes

Feb 16, 2012

I recently posted a problem with a game that I am making, I have worked on it but have become stuck. I am having trouble with creating an object from my class what I need to do is apply this class to multiple picture boxes so that I can have them moving on screen at the same time. I am unsure on whether or not I have set up the class correctly and am unsure on how to apply it to multiple picture boxes.

This is the class:
Public Class enemycar
Inherits PictureBox
Private speed As Integer
Private xposition As New Random
[Code] .....

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

Sorting A Class Of Multiple Properties?

Oct 13, 2011

I have created a Class, basically like this:

Public Class Person
Implements IEquatable(Of Person)
Public Sub New(ByVal Name As String, Optional ByVal Like As Boolean = True)
Me.Name = Name

[Code]...

View 4 Replies

Use An Instance Of A Class On Multiple Forms?

Aug 29, 2011

I don't know how to do this and I've googled this to death.

View 2 Replies

Using Multiple Class Files With One Form?

Mar 17, 2009

I'm trying to move some Subs from my form file (Form1.vb) to a seperate class file to keep my Form1 neat. To complete my application, I plan on creating several more classes that do different things, but that will also be used by Form1.My problem is that even when I add the Inherits command to the seperate class file (Inherits Form1), the Form1 part of the inherits command is underlined in blue along with the names of all the controls I'm using on that form.When I hover my cursor over Form1 in the inherits command, I get the following error:Class 'EmailSample' cannot inherit from itself.I've never been able to get working with seperate class files right, even when I do it as shown in tutorial videos, if it's not an error like this, it's "btnSubmit is not declared" or something like that..

View 11 Replies

Asp.net Mvc - 2 Multiple Model Definition From Linq To Sql Class

Aug 8, 2010

I call upon the VB ninjas out there. Here's my situation. I need to eventually be able to pass multiple models to a view. Currently I have a linq to sql class that, of course, has a bunch of generated model definitions. I need to make a model that implements multiple models. I somewhat understand how to do this in C#, but this project is testing my VB skillz. Here's some snippets from my linq to sql models. I need to combine these two into one model to pass to the view.

[Code]...

View 1 Replies

Calling Functions From One Class To Another And Using Multiple Forms?

Nov 21, 2009

The project requires a form that has textboxes for a students name and the amount of books they have read, and a label where the points they have earned for their reading is displayed. Also a seperate form with About information and yet another seperate form for summary information.

View 1 Replies

Create Multiple Classes Of Different Names That Use That Class?

Mar 6, 2009

Okay, say I have a class named "ChannelList", and it raises an event named "FoundChannel"

But what I'M wanting to do is create multiple classes of different names that use that class, but I want to have all of the "FoundChannel" events be handled under one single sub routine?

View 15 Replies

Extend Class Definition Across Multiple Files?

Feb 10, 2010

In order to organize various methods of my MainForm class, I would like to categorize them into several files. Of course, the methods would still need to access form elements and additional variables I added in the MainForm class.

View 3 Replies







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