Assignment Operators In Custom Class

Jun 19, 2009

I have a custom class that simply contains a public variable X.Let's say I have two instances of the class, A and B.If I execute an assignment operator, such as:A = B then I want A.X equal to the VALUE of B.X.But, I'm pretty sure that this will just assign B to the variable A.Assigning pointers, in C++ lingo.I looked in the VB.NET docs, which state that "The operator can be overloaded only as a relational comparison operator, not as an assignment operator."

View 7 Replies


ADVERTISEMENT

Assignment Operators Overloadable In .NET?

Apr 23, 2012

Why aren't the assignment operators (+=, -=, *=, /=) overloadable in VB.NET?

View 1 Replies

Missing Operators - Operators Are Not Visible Although They Are There Since The Program Will Work?

Feb 17, 2012

I recently installed visual studio 2010 and am using visual basic.The problem I am having is that some operators do not show up within the editor. For example the code line below
test = 3 + 5 - 6 / 7 * 4

only displays

test 3 5 - 6 / 7 * 4

the = + operators are not visible although they are there since the program will work as intended....and if I open up the .vb file in notepad everything is there. It just won't display within Visual Studio.

View 5 Replies

VS 2010 - Finishing An Assignment For Introduction To VB Class?

Nov 17, 2011

I'm trying to finish an assignment for my Introduction to Visual Basic class. I have to program an application that will determine if a word entered has consecutive letters in the alphabet as a substring of itself. Three examples are T"HI""RST"Y, AF"GH"ANI"ST"AN, and "STU""DE"NT.This is what I have so far:[code]....

However, it doesn't run properly. It says I'm trying to refer to a location that is out of bounds, although I don't see why.

View 12 Replies

Create A Custom Class That Has Inside An Array Of Another Custom Class?

Jan 31, 2011

I want to create a custom class that has inside an array of another custom class (see my code below) but when the programm runs is crashes. Why? What is the right expression???? Plz help I'm a newbie in VB.net.....

Public Class ctrarray
Public nameclass As String
Public ctrlindex(glvar_spaces) As ctrlindexclass
End Class

[code]....

View 6 Replies

VS 2010 Graphing Collatz Cojecture - Class Assignment?

Feb 6, 2011

I am working on a programing project for my college class. The program is working fine except when it graphs the data on the panel it flickers and doesn't always do it smoothly. I'm sure there are more efficent ways of doing this, but this is what my class specifically wants. Also, it must run on the timer otherwise I would have made it calculate without delay. Here is the

Program
Public Class Form1
Dim n As Double
Dim myGraphics As System.Drawing.Graphics

[code]....

View 3 Replies

Why Won't A Nullable Public Property In A Class Accept 0 (zero) As Assignment

Apr 17, 2009

I have a nullable public property on a class using Vb.net 3.5:

Public Property TicketCharge() As Nullable(Of Decimal)
Get
If _TicketCharge = Nothing Then

[code]....

View 4 Replies

Program Files Are All Mixed Up - In Class Saved Program In With Load Of Other Test Programs For The Same Assignment

Jan 8, 2010

In class i saved my program in with load of other test programs for the same assignment and got everything mixed up i finally figured out what was what and loaded the program in Visual Basic. Now my program doesn't recognize one of my forms when i try to access the design view of it. I hit run for the hell of it and the program runs with errors of course but the form1 "the missing one" shows up with all the buttons etc and i can use it.

Heres the link to the files. [URL]

View 3 Replies

Interface And Graphics :: Making A Custom Class That Mocks The System.Drawing.Rectangle Class?

Jul 6, 2010

I'm making a custom class that mocks the System.Drawing.Rectangle class because the Rectangle class doesn't have a name property. I need a name property because I am adding all of my rectangles to a collection and I need a little more info stored than just their locale and size. So I changed the _onPaint event but nothing is working out when I run the program?

Public Class Rectanglar : Inherits UserControl
Public BackgroundColor As Color = Color.Blue
Public Sub New(ByVal name As String, ByVal XY As Point, ByVal Widthy As Integer, ByVal Heighty As Integer)

[code].....

View 5 Replies

.net - WP7 Custom Class UI Binding?

Feb 4, 2011

I have a map with a MapItemsControl in my WP7 app that contains pushpins bound to items in a collection of custom classes. The pushpins are bound to properties of the item in the collection via a DataTemplate.When an item is added to or removed from the collection, all pins display correctly, with properties as per bindings, but when just an items' properties are modified, the UI does not update. The bindings just seem to get values from the source item upon loading, but I'd like them to keep the UI elements updated when the source collection items' properties are updated.To illustrate, I'll create a similar example:

Heres a custom class:

Public Class Box
Property CurrentColor As Color
Property Location As GeoCoordinate
End Class

[code]....

Whenever I add or remove items from TempBoxes, the pins all render as they should (e.g. if I specify a color in the collection item, the pin shows the color).Tapping on the item triggers the BoxTouched sub, which causes the item's color to change in the collection, but the UI doesn't change (pin color stays the same).To get the UI to update the color, I have to get it to render the pins again, by adding something like this to BoxTouched:

BoxControl.ItemsSource = Nothing
BoxControl.ItemsSource = TempBoxes

View 1 Replies

Arrays In A Custom Class?

Feb 14, 2009

I can't figure out why this does not work.

Public arrs(32) As ARR
Public Class ARR
Public nr As Integer

[Code].....

View 2 Replies

C# - Custom Installer Class?

Aug 4, 2009

I'm working on a project which needs some third party components prequisites to be installed before installing my .NET Application. Can someone tell me how to do it ?? I'm using .NET prequisites components to install the components like (.NET Framework 3.5,Windows installer 3.1,Crystal Reports) but what if i have some third party components which is not listed in prequisite lists ...

View 2 Replies

Custom Number Class?

Jun 8, 2010

I recently had the problem of trying to store an enormous amount of decimal places in a variable. Someone suggested that I create my own class to handle this. However I have researched extensively and can't seem to find a suggestion as to how I would do this. Would I read each digit into a list? How would I get each digit as to loop through a decimal, for example, and add each digit would still only give me 28 decimal places

View 8 Replies

Listbox And A Custom Class To Add Value?

Oct 21, 2010

Error Unable to cast object of type 'System.Data.DataRowView' to type 'M8_Rating.myItem'.Any idea what the deal is?

Dim MyItems As New List(Of MyItem)
For Each selItem As myItem In lb_forms_SecurityMgr.SelectedItems()
MyItems.Add(New myItem With {.Description = selItem.Description, .Value = selItem.Value})

[code].....

View 5 Replies

Moving From VB6 And Custom Class?

Feb 13, 2010

I have some questions regarding the dispose method as per custom classes.I imported a class using the upgrade tool and got introduced to the finalize method and this line of code within:

MyBase.Finalize()From what I have read this method is the class destructor and I should not be using it. Instead I should implement the IDisposable interface.

[Code]...

View 2 Replies

Serialize A Class That Is Not A Custom Of Our Own?

Apr 14, 2010

I need to look at the properties of an object and I cannot instantiate this object in the proper state on my dev machine. I need my client to run some code on her machine, serialize the object in question to disk and then I can analyze the file.[code]...

View 2 Replies

Using A Custom Class In HashSet

May 30, 2010

I created a custom class which just stores 3 byte values, (R G B to be exact), which constantly change. So my idea was to store that class in a HashSet, then create a new instance of the class (with different byte values) then add that to the HashSet. There can be duplicates, which is why I decided to use a HashSet, which will ignore an item if it's allready been added. Doing this on a List would be too slow.But I've ran into a problem. Adding a custom class to hashset seems to only allow 1 to be added. I assume this is because its hashing the class object while ignoring the data (byte rgb values) it contains? Is there a way around this? It's possible to convert the RGB to Color and just use that in the HashSet, but conversion is a bit too slow.

View 2 Replies

.net - LINQ To XML And Distinct Custom Class?

Oct 14, 2009

I have a very interesting LINQ question. I have a document, that I am trying to filter results on, but to filter, I am matching on a REGEX result from one element of the XML. I have the following, working LINQ to XML to get the individual data that I'm looking for.

[Code]...

View 3 Replies

.net - VB Datagrid + Array With Custom Class?

May 14, 2012

I have created a class "student" and made an array which contains students.I would not only like to display the array in a datagridview, but the array should also be updated if the user makes changes to one of the students in the datagridview.

I succeeded in showing the array in the dgv: one way is using datasource prop, the other is doing is diagrammatically. However, i can't find out how to let the user edit the array by editing the dgv.

View 1 Replies

Add Custom Class To A Generic List?

May 10, 2010

I created two classes. One class is StudentClass and the other is HomeroomClass. The HomeroomClass contains a readonly property as a generic list of the StudentClass. [code]...

View 6 Replies

Add Validate To A Custom Class Property

Mar 20, 2011

I'm trying to add validation to one of my class properties:[code]The value for the golfer's handicap comes from a oombo box on the form. Even if I have nothing set for this property at runtime, my validation doesn't work. I tried putting the If statement under Get instead of Set, and tried mHandicap = value after an Else in the If statement, but nothing seems to work. I'm working in the dark here and can't find anything suitable online. I was hoping to not go down the path of ReadOnly or WriteOnly properties as I'm not at that stage yet, but does this make a difference for my purposes here? Can anyone guide me as to what I'd need to do from this point? If I've got it right, you can add validation in the class and this means that you then don't need to repeat this validation in the form??

View 3 Replies

Create Custom Button Using Class?

Nov 20, 2009

I use this code to create the same Button in multiple Forms[code]....

View 6 Replies

Creating Custom Generic Class?

Jan 1, 2011

Here are essential excerpts for the code creating the class and the page using it:

Imports System.Collections.ObjectModel
Public Class Test (Of T as xyz)
Inherits Collection (Of T)

[code].....

View 7 Replies

Custom Class And Random Numbers

May 30, 2009

I am still learning vb.net and decided to make a "horse race" to get a better understanding of inheritance and such. So first of all I made a horse class that inherits from the picturebox. I gave the horse properties such as image, height, width, x-position, and y-position. I also gave the horse a speed(between 1-1000). My idea was to have the horses start at the starting line and get them to move using a timer. Each time the timer fires the move method executes. The move method creates a new random number(seeded by DateTime.now.milisecond) between 1-1000, if the random number is lower than the speed of the horse it will "move" adding 1 to the x-position property.

Here is the code for the class :
Public Class Horse
Inherits PictureBox
Private m_speed As Integer
Private m_picture As Image
Private m_xposition As Integer
[Code] ....

Now things work as I expected for the most part, I created two new horses and gave them values, if one is "faster" than the other it will move faster. Here is the code I use to create two horses and put them in an array:
Private thisHorse As New Horse(700, My.Resources.Horse__Small_, 20, 30, 100, 100)
Private secondHorse As New Horse(700, My.Resources.Horse__Small_, 20, 150, 100, 100)
Private horseArray() As Horse = {thisHorse, secondHorse}

I give the horses visual representation using a loop during the load form event:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each i As Horse In horseArray
i.Visible = True
[Code] .....

The only problem is if I give them both the same speed they seem to move in unison. I have tried adjusting the x-axis increment and have seen them both jump at the same time. Now I realize since they have the same "speed" they should have close to the same movements but wouldn't the random factor in the move method create some discrepancy between the two? I have ran this multiple times and am still unsure what the problem is.

View 3 Replies

Custom Class As An Array Of Properties?

Sep 30, 2009

I'm moving my first steps in the VB.NET world (I come from VB6) and I'm stuck with the creation of a particular class.

Let's say we have a bus that always has 101 places. I'm trying to create a class containing the map of the bus, along with methods to graphically represent it.

My "Bus" class will have a couple of properties ("BusColor", "BusModel") related to the whole bus. Then it should have a property called "Places" whose type is a custom class thet represents every single place, along with, for example, the passenger name or the place number. This property should of course be an array.

This is my code so far (simplified):

Public Class BusMap
Private Const MAX_PLACES As Integer = 101
Private _BusModel As String = ""

[Code]....

but I wonder if there is a more standard way of doing this.

My second question is: how can I modify my class to be able to iterate its Places property with the "for each" statement? A quick search on the web showed up that I should implement the IEnumerable interface, but I'm still not enough confident with the concept of Interfaces.

View 6 Replies

Custom Class In DotNetNuke Module?

Mar 21, 2011

I know this can be done as there are other modules out there that have this, but I'm just not getting it to work.

I have created a custom module for a DotNetNuke site. I want to be able to create a class object within the module to hold the information about that object. I can create the object and everything complies. But when I go to use the object in the code-behind it states that the object is not defined. I'm not really sure where to go from here.

This is the beginning of the View.ascx.vb :

Namespace Modules.VacationForms
Public MustInherit Class View
Inherits PortalModuleBase

[Code].....

I'm really not sure why this is not working. I did download another module code to compare and as far as I can tell everything is the same.

View 2 Replies

Custom ComboBox And Class Items

Apr 14, 2009

I have a custom combobox. Items are of this class
Public Class CustomItemsCombo
Public Sub New(ByVal valore As Integer, ByVal descrizione As String)
Me.Valore= valore
Me.Descrizione= descrizione
End Sub
[Code] .....

View 2 Replies

Dynamic Array Of Custom Class

Jun 16, 2009

I've been programming in VB.net for a while off and on, but never really had a need to use custom classes till now.I built a function in a module to populate a class, The class how ever is supposed to refer to one instance.I need to create an array of this class but the amount of instances needed is not always known.Works fine till the class goes to populate the class array.[code]It's probably something simple, I've just starred at it to long. Keep gettitng "Object reference not set to an instance of an object."

View 1 Replies

Dynamic Custom Class Property

Dec 18, 2009

I have a For Each block loops through a list of objects, the objects are all instances of a single custom class I have made which has multiple properties.The logic used in this block uses a property of the custom class to do a set action, is it possible to dynamically supply which property it uses in the logic? This will be more efficient and prevent me from having to create this logic over for each property of the custom class.My best guess was that maybe it is possible with reflection, however my searches into reflection have left me more confused.

View 2 Replies

Get Properties And Methods For Custom Class?

Oct 29, 2009

Is it possible to iterate through the properties and methods of a custom class, getting the details about those properties and methods in the process.[code]....

View 2 Replies







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