Make Some Members Available To Only One Object?
Jun 4, 2011
I have an EggSac object which contains references to >100 000 Egg objects. Some variables in the Eggs have to be maintained to be consistent with EggSac, so I want to make these only changeable by EggSac. However EggSac passes references to its Eggs all over the application, so if I use public methods then any other code could modify the secure parts of the Eggs by accident.
What's a proper OO way to make sure only the EggSac object can call the "secure" methods of the Eggs, but still make the "safe" methods available to everyone?
My idea is to split Egg's class into a base class containing only safe methods and a derived class containing the secure methods that only EggSac should have access to. Then EggSac has members of the type of the derived class, but it casts them to their base class whenever something else wants one.
View 2 Replies
ADVERTISEMENT
Apr 16, 2010
I'm trying to change the data binding of a listbox when the value of a combo box changes.Here is the ComboBox change code - [code]...
View 1 Replies
Jun 13, 2011
I have a 3rd party object that gets passed to one of my methods. The object contains 20 or so string members. How can I easily list all of the string names and their values?
View 2 Replies
Jan 5, 2010
ok this is annoying, i've got a structure RInteger.
Private VAR_Value As Integer
Private VAR_Max As Integer
Private VAR_Min As Integer
[code]......
View 5 Replies
Oct 4, 2011
I have an enumeration in the form[code]...
I would like to use these as values in a ComboBox, but I would like to display the strings "My Stuff" and "My Things" respectively.
I'm sure I've seen a method for quickly creating some kind of local object definition where I can assign a string property to be displayed, and a "MyCollections" type property to store the value of the enum element, but I can't for the life of me think of how to explain that to a search engine.
View 3 Replies
Oct 16, 2009
Say I have a List(Of Tag) with Tag being an object. One member of Tag, Tag.Description, is a string, and I want to make a comma-separated concatenation of the Description members.Is there an easier way to do this than to read the Description members into a List(Of String) and then use the Join function?
View 2 Replies
May 20, 2012
Ok i need to make an object in this case a picture box draw a line to another picture box with the shortest length while avoiding other type of objects such as labels i am not sure how to do this but so far i have come up with
Private Sub ProgressBar1_ParentChanged(sender As Object, e As System.EventArgs) Handles ProgressBar1.ParentChanged
If ProgressBar1.Value = 50 Then
[code]....
View 1 Replies
Sep 15, 2009
Each business object has a matching object that contains sql calls. I'd like to restrict these sql objects in a way where they can only be used by the matching business object. How can this be achieved?
Update Greg brought up the point about testability. Since the SqlObjects will contain very business-process specific sql I don't want them reused in multiple buiness objects. (Basic CRUD operations are all code-generated) Is there a way to make the SqlObjects accessible to only one business object in the business assembly (like yshuditelu and Greg Beech showed) AND expose the SqlObjects to the unit testing assembly?
View 4 Replies
Oct 23, 2011
I have VB 2010 Express installed & are working through some Labs.Also I'm trying to run my first code into an external software package acad.exe. I'm supposed to be able to launch this via right click properties underproject name then on debug tab, again can't find ?
View 7 Replies
Apr 5, 2012
I am making a simple maze game that you use the arrows keys to navigate. I completed the movement part of it, but now i'm having trouble with the walls. How can you make an object not pass through another and how to tell the program what to do when a object gets to a defined place(the finish)
View 4 Replies
Nov 17, 2011
I am coding an application for seats reservation and it contains two forms one of the forms contain 32 labels that represent the seat number and when the user wants to reserve that seat, he/she can double click that label to bring up the other form . The other form contains 2 text boxes (Name,Phone) and Date time picker, and I have remove and save. The remove button should change the backcolor of the label that was double clicked in the first form to white. The save button should change the backcolor of the label that was clicked in the first form to yellow. Yes I am using an array.
View 1 Replies
Jul 22, 2010
How to make a object moving on the screen- How to make game with VB.NET
- In 2d game, ex i see a mario charator, which is object ( Label, image v.v.v)
- Is there a physical engine for vb.net
View 3 Replies
May 18, 2010
Imports db = System.Data
Public Class CustomerADO
Dim cid As Integer
Dim fn, ln, em, pw As String
Dim bl As Decimal
[Code] .....
What should I do in the while loop to make array of customers objects. And what should be the code in the form to add this array of customers to listbox.
View 2 Replies
Jun 2, 2012
In this chunk of a code, the writer makes a reference to a recordset object and I just wanted to make sure I understood why before moving on. [code]...
In LoadDataBound, it says set rs = GetData(). This calls to the Function below, but why does it require to be set as an object of the rs recordset. Correct me here, because i'm most likely wrong, but does it require this so that you're able to make a function out of the recordset without having to use the same name for both (recordset and function) ? Or is there another process going on here that i'm unaware of.
View 1 Replies
Mar 27, 2012
So I have been trying to make this game in visual basic, it is basically like the worlds hardest game but in viusal basic but I am having problems programming the enemy, it doesn't seem to move up and down or left and right at all.
[Code]...
View 4 Replies
Feb 7, 2011
I have not asked any questions in a long time because I have not been programming. But I am now back again with a question about Graphics.I want to make an object of a detailed checker. What I mean by detailed is there is going to be a big ellipse, then it is going to have a hole bunch of ellipses going around the edge to give it the checker affect.
How do I bind it all or make it all into one object and do something like a button has when clicked (Handles Button.Click) but with this object so I can move it.Is it possible to do this? If so can someone tell me how?
PS. This is my first time dealing with Graphics, so go easy on me ;)
View 3 Replies
Jul 28, 2009
I've recently began to use OOP in my application and now I'm stuck on how to use it properly.
View 2 Replies
Aug 5, 2011
I'm using the following code in a singleton remoting object MBRO. This function is only called on the server side.
''' <summary>
''' Return a cached DataCentricObject
[code].....
View 1 Replies
Sep 21, 2009
Is there a way I make a file that contains the information for a contextmenu?The reason I'm asking this is because I want to make a program that can customize a contextmenu and then turn it into a file that can be opened by another program I'll make so it can be used by the new program.I feel I'm not explaining well, so I'll try to break it down. This will be slightly hypothetical, and this is the case that I find out how to do this.
I open my program to create the context menu that will do tasks specified by the tag for the buttons. So I create all the buttons in my app, then I press a button and it saves the contextmenu as some sort of file, this file can then be opened by my other program. My other program opens my contextmenu file and applies the contextmenu to a textbox. So how can I do this?
View 2 Replies
Oct 24, 2011
Im trying to search the entire active directory to look for a group and then see if the current logged on user is listed, then take an action based on that result.So far i have the below code which doesnt return the users who are members of the group MyTestGroup. Could anyone assist or guide me to see how i achieve this?
View 4 Replies
Aug 13, 2009
something like this
pctObject.horizontalPosition += 5
I just dont know the right syntax
View 2 Replies
Oct 7, 2009
I put some group boxes on a user interface and now labels and pictures that are set to visible can't be seen even when the group box is set to visible = false. (I have the group box and the pictures and labels in the same place on the form and was planning on using buttons to make them visible and invisible but the pictures and labels stay invisible no matter what while being in the same place as the group box.)
Does anyone know why group boxes do a sound job of making things invisible and how to correct it?
View 24 Replies
Jul 9, 2011
I am struggling to do what i want with classes at the moment as they are killed off at the end of a method, can somebody let me know how to make the classes live until i tell them to die? so that i can create one and refer to it from another method at another time? For example On form load i create a class Dog.Then later on i want to get info from the Class Dog. But it is no longer instantiated
View 6 Replies
Mar 14, 2010
how do I set an object array using a loop so I don't have to type each button name?
[code]...
only problem with that is it assigns a string value. I need it to assign an object. any suggestions?
View 11 Replies
Nov 29, 2010
According to this post the code below should compile, while it is not.
class Base
protected m_x as integer
end class
[code].....
View 3 Replies
Oct 25, 2009
I migrate between C++ and VB.NET in my coding ventures... which leads to the occasional confusion about when something is by value or by reference in VB.NET.Let's say for example that I have an array of MyObject which is populated with a bunch of objects.
dim MyArr(5000) of MyObject. let's say that the information from this array travels throughout various data structures:
dim MyList as new List(of MyObject)
for i as integer = 0 to 5000 step 1000
Mylist.add(MyArr(i))
next
Under the above scenario, I believe everything is by reference. If I extract an entry from "MyTable" and modify its MyObject Members, I think that the original in MyArr will be modified.However, I have run into situations where I thought something was by reference, and it was by value. Are items always added to containers by reference, or are they sometimes added by value?
View 3 Replies
Jul 2, 2010
I'm having some headaches using Structures and functions that return Nothing in VB.NET. [Code] In the previous code, when I return Nothing as result of Foo function I'd expect that st is Nothing. But this is not what happens. Then I found in MSDN documentation: Assigning Nothing to a variable sets it to the default value for its declared type. If that type contains variable members, they are all set to their default values.
So I discovered that when I assign Nothing to a structure, all its members are set to their default values, instead of the structure itself.
Also, I tried to make st a Nullable type by declaring: Dim st As Nullable(Of Test) = Foo()
but, still I can't check if st is Nothing by using: If st Is Nothing Then
or If st.Equals(Nothing) Then
So, questions:
1 - Is it possible to assign Nothing to the structure and not to its members?
2 - How can I check if a return structure value is Nothing?
View 4 Replies
Jan 23, 2011
According to a mspress book (MCTS for Exam 70-536 .NET 2.0): You might have version compatibility issues if you ever attempt to deserialize an object that has been serialized by an earlier version of your application. Specifically, if you add a member to a custom class and attempt to deserialize an object that lacks that member, the runtime will throw an exception. In other words, if you add a member to a class in version 3.1 of your application, it will not be able to deserialize an object created by version 3.0 of your application.
Now... As curious as I am I went and created a project, serialized a class, added a new member and attempted to deserialize the class to the new object. To my surprise it worked and the newly created member was set to null by default (even if it had another default value).
[Code]...
View 3 Replies
Oct 25, 2010
I wrote some code to add the Name and Value to Combobox.
dt = New DataTable
dt.Columns.Add("Name")
dt.Columns.Add("Value")
[Code]....
Now i want to enumerate all the ValueMemer (11,22,33,44) and all the DisplayMember (AA,BB,CC,DD) from Combobox1, how to do?
View 7 Replies
Nov 23, 2010
i have to develop API in .Net 4.0 which can be used in VB 6.0,i know how to use this and currently i am using my this API in VB successfully.but Stuck at one place,i have collection class and i have to expose it to VB with having functionality of List class of .Net.[code]i know that generic is not supported in VB, but i think with this declaration in VB 6.0 it creates interface class for class B as IList.but in VB using object creation of class B it doesn't provides me members of LIST in intellesense like (Add,Remove of List Class)
View 2 Replies