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


ADVERTISEMENT

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

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

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

VS 2010 Structure Classes So That The User Interfaces Though A Single Class While The Supporting Classes Are Hidden From Their View?

Jun 13, 2012

How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:

Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()

[code].....

So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:

interface.Economic.MyMethod
interface.Currency.MyMethod
etc

This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.

View 23 Replies

VS 2010 Calling Subs And Functions Within Classes That Are Within Classes?

Oct 24, 2009

Here is some example code of what I mean:

vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click

[Code]....

View 5 Replies

Derived Classes Cannot Raise Base Classes

Jul 10, 2009

I m trying to raise Click event of Textbox explictly but I m getting "Derived classes cannot raise base classes" error.[code]....

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

Loop And Enumerate Properties Of Nested Classes In Nested Classes?

Sep 24, 2010

so far i got

code
For Each item As Reflection.FieldInfo In GetType(NameSpace.ClassWithNestedClasses).GetFields
rtfAppend(item.Name & ":" & Tab & item.GetValue(Me))
Next
For Each item As Reflection.PropertyInfo In GetType(NameSpace.ClassWithNestedClasses).GetProperties()

[code]...

which gets me the simple string vars and properties of my top class, but how can i apply this to loop through all sub classes and get there vars and props?

View 1 Replies

VB XML Classes Vs String Classes?

Oct 13, 2011

Searching the internet finds no less than 700 different ways and opinions to accomplish what I'm trying to do, and I would just like to know the simplest, most bullet-proof way possible.

[Code]...

I simply want to extract the string "bar," which is inside <hostName></hostName>I can do this easily enough with simple string functions, but I'd like to do it with one of the .NET XML classes/methods.

View 2 Replies

Best Pratice In Inheritance - Three Classes Employee, Manager And Salesman. Manager And Salesman Classes Inherits Employee Class

Jul 27, 2010

I have three classes Employee, Manager and Salesman. Manager and Salesman classes inherits Employee class.

Employee :

Public MustInherit Class Employee
' Field data.
Protected empName As String
Protected empID As Integer
Protected currPay As Single

[CODE]...

Manager :

Public Class Manager
Inherits Employee

[CODE]...

Salesman :

Public Class Salesman
Inherits Employee

[CODE]...

Now I have created a object of salesman and manager using the following code:

Dim objSalesMan as Employee=new Salesman("xyz",1,2000,5000)
Dim objManager as Employee=new Manager("abx",2,5000,"production")

Is this a good programming pratice or should I use:

Dim objSalesMan as new Salesman("xyz",1,2000,5000)
Dim objManager as new Manager("abx",2,5000,"production")

View 6 Replies

.net - Events In Classes?

Jun 17, 2010

I find that I write a lot of code within my classes to keep properties in sync with each other. I've read about Events in Classes, but have not been able to wrap my head around how to make them work for what I'm looking for.For example, in this one I always want to keep myColor up to date with any change whatsoever in any or all of the Red, Green or Blue properties.

Class myColors
Private Property Red As Byte
Private Property Green As Byte

[code]....

If one or more of those changes, I want myColor to be updated. Easy enough as above, but is there a way to work with events that would automatically do this so I don't have to put myColor = Color.FromArgb(Red, Green, Blue) in every sub routine?

View 3 Replies

.net - Use Classes In Several Projects?

Jun 8, 2011

How can I create a namespace and classes in it, then save it, and reuse the namespace in other projects? Do I have to click on Create Class Library in Visual Studio?

View 2 Replies

Asp.net - Project Which Has Set Of Classes In .net?

Jan 12, 2012

I am new to .net and was wondering if there are any projects which have sets of vb.net classes online which i can use. For example we have Flourish — PHP Unframework which has lots of php classes therefore a programmer doesn't not to replicate code on each project. Is there a asp.net (vb) resource website or any open source project which has built in vb.net functions.

View 3 Replies

Calling Sub From Other Classes - No Value?

Oct 28, 2009

created class TestA. There is Sub mysub defined inside it. Now I want to use this Sub in other class. So far I did like this:

Dim oTestA As New TestA
Dim dblA As Double
dblA = oTestA.mysub

[code].....

View 3 Replies

Can Sub Routines Be Placed Into Classes For Later Use

Feb 6, 2011

I have a slew of sub routines that I need to use in my software because each website that I will be accessing don't all use the same methods.....go here...click that...go here...click that...etc etc

So I've divided them into sub routines and call them when I need them but the coding is getting so long that it's becoming confusing to keep up with each sub.

Is it possible to place the sub routines into an independent file like a class and then call them from the file when I need them so I can free up some space to code?

View 1 Replies

Classes And Objects?

Aug 29, 2010

The 1st part of the code required me to write a class definition for a class(Worker). The class should include Private variables and Property procedures for a worker object's name and salary.

The salary may contain a decimal place. The class should also contain two constructors:a default and a parameterized.

The second part for the code indicates that I need add a method named GetNewSalary to the Worker class.The method should calculate a Worker objects new salary, which is based on a raise percentage provided by the application using the object.

Before calculating the new salary, the method should verify that the raise percentage is greater than or equal to zero. If the raise percentage is less than zero the method should assign the number zero as the new salary

There are three text boxes which allows the user to enter the employees name current salary and raise percentage....the calculate button will display the new salary in the new salary label box...so far here is what I have for the worker class.

The Class for the code had to be written from scratch. Can you please look over the class code and see if I need to chang anything....that will allow the program to run.[code...]

View 1 Replies

Connecting To Sql Using Classes?

Jun 5, 2011

'A way to connect to SQL with VB.Net using Classes

'This must be a class on its own
Imports System
Imports System.IO

[code].....

View 3 Replies

How To Add C# Classes To Vb Project

Mar 18, 2009

How can I add c# classes to my vb project. I am using vb .net express 2008

View 1 Replies

How To Get To Grips With Classes

Mar 10, 2011

I am trying to get to grips with Classes and how to use them "efficiently", So bearing this in mind I decided to create a small class driven application.I am struggling to understand how I can "use" this new instance of this user somewhere else.

Test Data was
Name : Joe
username : JoeBloggs
Password : JoesPassword

[code].....

Now this works and updates the listbox with the new instance of the user but how can I use that instance from the listBox control to retrieve that users details?

View 14 Replies

How To Turn Classes Into XML

Apr 15, 2011

As easily as possible? How to parse and create XML easily?

View 3 Replies

How To Write Classes

Mar 5, 2010

how to write classes. I have been searching and I understand classes a little. What I am confused on is how to write a class that contains more than 1 bit of information. How would I write a class that contains someone First Name, Last Name, Age, Address, City and State they live in. For instance all the information in the class can be retreived if I enter the person last name. And the class has to have more than 1 person infomation in it.

View 8 Replies

Import C# Classes From Dll In A .net Dll?

Feb 16, 2012

IDE: VS2010 Framework.net: 4.0 I created a c# dll project under Visual Studio 2010, with several public classes, and I would like to use its classes inside another dll project, but written in vb.net.

In the vb.net dll project, I referenced the built c# dll, but impossible to import the c# classes. The namespace of the c# dll is even not recognized.

What must I do to see my c# classes? If this is possible.

[Code]...

View 4 Replies

Integrating C++ Classes Into VB?

Nov 7, 2011

How do I integrate C++ into Visual Basic applications made in Visual Studio?

View 4 Replies

Referring Between Classes?

Feb 21, 2010

I am trying to do is get interoperability between my "mainwindow" and a class. As far as I know the way to do this is to create an instance of the class (in "mainwindow") for example and then use that instance to call the functions etc... This works. However I want to allow the class to call functions in the "mainwindow" The moment I declare the instance on the class as well it goes into an endless loop.

View 4 Replies







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