VB 2008 - Collections Which Store Object As Byref

Feb 24, 2009

is there any collection in vb.net which store object as byref and not byval.

View 4 Replies


ADVERTISEMENT

Store ByRef In A Variable?

Jun 4, 2009

Just wondering if it's possible to store a reference to an object in a variable.

I will elaborate:

[Code]...

View 5 Replies

Byref New Object - Top Pass New Object As "byref"?

Sep 7, 2009

Below I tried to do an Example:

[Code]...

Below is the called method: Friend Sub SplitOU2(ByVal inDN As String, ByRef OUDN As Object, ByRef Organisation As Object, ByRef VerksamhetTyp As Object) By doing this I can skip to declare the in this example "useless" variable Dim VerksamhetTyp as Object = "".

View 3 Replies

Store Data In Several Collections?

Mar 31, 2011

I'm not sure how to do this but I want to store data in several collections. I want the data to be stored / accessed as follows.

CombatCollection("Joe").CombatRecord(1).AttackRecord(1).Damage

how these nested structures or collections are defined and used?

View 9 Replies

Passing Null Object() ByRef Returns Initialized Object()?

Dec 8, 2009

I am making use of a 3rd party dll and am encountering some strange behavior in VB, which doesn't occur in C# Perhaps someone can explain what is going on. Anyhow, I am making use of a method in this 3rd party library which accepts an array parameter ByRef. The end result is the variable should remain null after the method call, but it is returning initialized for some reason.

[Code]...

View 2 Replies

Pass The Property Of An Object To A Function ByRef

Jul 16, 2009

If you pass the property of an object to a function ByRef, and the function doesn't modify the ByRef parameter, the property Set is still called.

[Code]...

View 11 Replies

Reflection - Get The Name Of The Object Passed In A Byref Parameter?

Aug 29, 2011

How can I get the name of the object that was passed byref into a method?

Example:

Dim myobject as object
sub mymethod(byref o as object)
debug.print(o.[RealName!!!!])
end sub

[code]....

I'm using this for logging. I use one method multiple times and it would be nice to log the name of the variable that I passed to it. Since I'm passing it byref, I should be able to get this name, right?This would give you the parameter name in the method and it's type, but not the name of the variable that was passed byref.

using system.reflection
Dim mb As MethodBase = MethodInfo.GetCurrentMethod()
For Each pi As ParameterInfo In mb.GetParameters()

[code]....

If you put that in "mymethod" above you'd get "o" and "Object".

View 3 Replies

C# - Extending An Object And Any Child Collections?

Jul 30, 2009

I have an class named Foo. This class contains a collection of child objects of type FooChildBase, but I also have a further class of type FooChildTwo which inherits from FooChildBase.

Class Foo
Public Children As IList(Of FooChildBase)
End Class
Class FooChildBase

[code]....

What I would like to do is have my FooSpecial Class treat it's Children collection as if they were FooChildSpecial objects, but still be able to add FooChildTwo objects to it. Is this possible and if so how can it be done?

EDIT:I need to FooChildSpecial class to wrap any of the objects in the Children collection with the extra values, whether they are FooChildBase or FooChildTwo?

View 3 Replies

Collections - Specifically About The Request.Cookies Object

Sep 20, 2010

I have a question specifically about getting the current cookies set to a particular visitor on an ASP.NET webpage. I understand you need to use Request.Cookies - and by default it returns a collection of all cookies set, as an HTTPCookieCollection. However, the MSDN documentation states that you do: Request.Cookies("Username") as an example, in order to fetch an individual cookie and then compare whether it is set, etc. All fine and dandy but why adding parentheses and a string does the type suddenly change to
HTTPCookie.

I understand HTTPCookie is for dealing with individual cookies and HTTPCookieCollection is for dealing with multiple cookies at a time for like iteration purposes, etc., but I don't understand when on the MSDN documentation it explicitly states that the Request.Cookies property (the Cookies property) is of type HTTPCookieCollection, and if you do what I explained it changes the type (I can see this from IntelliSense) and it does not state this happens in the MSDN documentation. I'm not asking about the MSDN documentation lol, but why this happens when adding the parentheses and a string denoting the cookie name. I'm still pretty new to Visual Basic. By the way, I'm doing this all in Visual Web Developer although using VB as the language of choice.

View 3 Replies

How To Filter Object With Specified Type In Generic Collections

Jan 3, 2012

given the following class structures:[code]I add the following property to MyList, trying to answer questions like "find out the number of elements with specified type, say Derived1, inside MyList?"[code]

View 1 Replies

Pass An Object Variable But Doesn't VB Force Decalre The Header As ByRef?

Oct 20, 2011

Why if you pass an object as byVal into a method is it then treated as if it were byRef? I know you're only passing the reference across when you pass an object variable but why doesn't VB force you to decalre the header as byRef?

View 2 Replies

IDE :: Debugging Nightmare: Cannot Drill Down Into Object Collections In QuickWatch Window?

Mar 15, 2007

My colleague and I have recently upgraded our projects from .NET Framework 1.0 and VS2002 to .NET Framework 2.0 and VS2005. We also applied the latest VS2005 service pack.

Our problem: normally when debugging we use the QuickWatch window to drill down into and view collections of objects belonging to the parent object we are "watching". THIS NO LONGER WORKS...instead, we get a message in the value line against the object collection saying:"In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."This is incredibly frustrating, particularly when we have large nested collections of objects.We are pretty sure this feature was working fine after we upgraded, but we are not so sure that it was working after we applied the VS2005 service pack.

View 1 Replies

Iterate Through The Keys And Values Collections Of A Dictionary Object Using An Index?

Apr 25, 2009

I have a VB.NET project where I am able to iterate through the keys and values collections of a dictionary object using an index:

MyDictionary.Keys(idx)
MyDictionary.Values(idx)

When this code is taken from the test project and placed into the real project I get the following error:

'System.Collections.Generic.Dictionary(Of Double, String).KeyCollection' cannot be indexed because it has no default property.[code]...

In the line in sub search that says "dtf.Keys(idx) = 0" place your cursor after the right parenthesis and backspace you should get a tooltip that says, "<Extension> ElementAtOrDefault(index as Integer) as Double - index: the zero based element of the index to retrieve.

View 3 Replies

Populate System.Collections.Specialized.StringCollection Object From A Text?

May 6, 2010

Say I have a text file I want to load it to a System.Collections.Specialized.StringCollection

object dim a as System.Collections.Specialized.StringCollection

set a = a contains many systems System.Collections.Specialized.StringCollection object.

Each line in text.txt go to an element in a.

View 7 Replies

LINQ Query To Group Data Between Two List Collections, Populating A Nested Object

Oct 26, 2011

I have these objects:[code]Using LINQ I need to take a List(Of MakeInfo) and a List(Of ModelInfo) and aggregate the StockInfo from ModelInfo into the List(Of MakeInfo).So for each MakeInfo I will have a total count of all stock where MakeInfo.Name = ModelInfo.Make, and also a minimum price.I think it's going to be something like this, but I'm having trouble accessing the nested object and not sure if it's going to be possible with a single query.[code]

View 2 Replies

Access To Object Passed ByRef In The Constructor Of A Class Through Another Part Of The Class?

Aug 18, 2009

I have some classes, BsfciFile and StudyFlashCard. Bsfci is the extension to which I save my set of flashcards in an INI format. I am currently working to transform my code from using Windows API calls to access the INI to using a IniFile class that I found on the internet. I would like the BsfciFile to have a Array of StudyFlashCard objects, but I would like the StudyFlashCard class to use the IniFile class object contained in the BsfciFile class. I can pass the IniFile from the BsfciFile class to the constructor for the StudyFlashCard class, but I want it to modify the same IniFile as the BsfciFile class has later on.

[Code]...

View 1 Replies

Asp.net - Value Of Type 'System.Collections.ArrayList' Cannot Be Converted To 'System.Collections.Generic.List(Of ITextSharp.text.IElement)'

Sep 21, 2011

I'm having a problem with this code in the highlighted line(*); getting the error in the heading.

Dim htmlarraylist As New List(Of iTextSharp.text.IElement)
htmlarraylist = *HTMLWorker.ParseToList(New StreamReader(tempFile), New StyleSheet())*

[Code].....

View 2 Replies

Object Passed ByRef To Form, But Not Accessible Throughout Form Class

Feb 18, 2010

Hi

I've got a pretty general question about the best practice in passing an object reference to a Form in VB.NET. My form is a dialog and I've created an overload ShowDialog method, where I pass an Object into it ByRef.

The trouble is, I want to be able to refer to that Object throughout my dialog Class and not just in the ShowDialog method. For instance, some of my Events for controls on the form, need to reference that object.

I know I could create a local Private variable in the Class and assign it to the passed value, and then use that value. However I'm thinking this isn't very efficient because it would (I believe) create a new copy of the Object (which is a complex, large class in itself).

View 8 Replies

.net - ByRef Underlined With "Expression Expected" Error When Trying To Pass In A Object Of Type List(Of ClsFooDetail)?

Mar 3, 2010

I work with C# 99% of the time. However, I'm having to update some legacy VB.Net code and encountering an issue with VB.Net code syntax. The error that I get is "ByRef" is underlined and "Expected Expression" tag shows up when you hover over "ByRef". The "FooDetail.Load" function is written in C# and expects a List object passed as reference. Don't have any trouble using the same function in other C# classes. Can someone indicate what is wrong with below VB.Net code.

Dim FooDetail As New clsFooDetail()
FooDetail.FooID = FooID
Dim lstFooDetail As New List(Of clsFooDetail)
FooDetail.Load(ConnectionString, "Stored Procedure", ByRef lstFooDetail as System.Collection.List(Of(clsFooDetail))

View 1 Replies

Error - Unable To Cast Object Of Type 'AbstractListlistIterator' To Type 'System.Collections.IEnumerator

Dec 22, 2010

I have a series of API calls that are returning J# data types. I have been able to convert most of the data types (Integer, Boolean, Double, Float, etc) just fine.What I need to do now is convert a java.Util.Collection to a VB .NET collection (ArrayList)

Here is my attempt:

Public Function MakeDotNETCollection(ByVal javaCol As java.util.Collection) As Collection
Dim dotNetCol As Collection

[code]....

I keep getting a runtime error "Unable to cast object of type 'AbstractListlistIterator' to type 'System.Collections.IEnumerator.

View 1 Replies

.NET Inheritance With Collections "Object Reference Not Set..." Errors?

Nov 7, 2010

I am constructing a collection of objects, and need to use inheritance on a base class - I have been trying for hours in various ways and can't get this to work whatsoever - the error is always "Object reference not set to an instance of an object." The idea in the example below is that an object is instantiated, and within that lies a collection of Students when I try to access the oDemo.Students(0).Name property the error is raised. Otherwise the object appears to have instantiated OK.Here is the code being used to instantiate and access the class (from ASP.NET).

Dim oDemo As New MyDemo.Students
lblTest.Text = oDemo.Student(0).Name
Here is the sample code from the class library:

[code]......

View 2 Replies

Convert A System.Object To A System.Collections.Arraylist?

Oct 13, 2010

I am using Visual Studio 2005 and am writing a SSIS package. In the package I have a VB.Script that looks at a directory on a server and creates a list of the files. I then have a store Proc that looks at a table and gets a list of files that matches the files in the first array. The result is a fullresultset. The next step I need to create a 3rd array that only contains the rows from the first that are not in the second. However, I am getting the following error. Error: The script threw an exception: Unable to cast object of type 'System.Object' to type 'System.Collections.ArrayList'.

View 3 Replies

System.Collections.Specialized.StringCollection Vs System.Collections.Generic.List(Of?

Feb 5, 2011

[code]...

What's really the point in using the former?It's hard to use linq if I used the former. I have to convert that to an array first which is difficult because there is no (asarray) function.I think I would change all of my code that's using System.

Collections.Specialized.StringCollection to System.Collections.Generic.List(Of String)

View 2 Replies

VS 2008 Create A Byref Variable?

Jul 16, 2009

How would I create a variable and assign it to another variable and when I change one variable it will be changing the other also?

View 3 Replies

VS 2008 Passing ByRef Or ByVal?

Jul 23, 2010

I have been working on this for a few days, and I am going around in circles. I can make the program work by including everything in the same sub procedure, but the assignment requires that I do certain tasks by using function procedures.What I need to do is take the contents of a text box, reverse the order of the first and last names, and add them to a list box. I can do that, just not by passing value from a function procedure. Here is my

View 4 Replies

VS 2008 ByVal / ByRef List Parameter

Sep 4, 2010

I have a class OrderManager, that takes a parameter of type LocalFuturesList on construction. Now.. It doesn't seem to matter if I use ByRef or ByVal here.. It still references the parent class instance of it. It also doesn't seem to matter if I type New or omit it.. Probably also because it's just an address reference. But why is it like this? And what type of objects "acts" in this way? Further I find that if I change the object in the parent class by deserializing from a file (with my method call shown), then suddenly this reference is broken in some way, so the OrderManager instance now holds Nothing I believe.If my observations are correct I see two challenges:

1. How to pass a list NOT by reference?

2. How to maintain a list reference through deserialization? [code]

View 17 Replies

VS 2008 Passing Parameters - ByVal/ByRef?

Dec 22, 2010

I have some code that is transforming the coordinates of a line.I want to keep the original coords and I thought passing the line ByVal would be the best way.The original VB6 code used a temporary variable so that the original coords were not updated.I'm confused as when the X & y coords of 'line' are changed 'MyLine' is also changed. I had assumed only 'line' would change and 'MyLine' would remain unchanged'.

Private Sub TransformSaveLine(ByVal MyLine As LineType)
Dim P As Integer
Dim line As LineType
Dim x As Double

[code].....

View 12 Replies

How To Store An Object In Register

Feb 26, 2009

I wish to store, and recover some simple object in the register, a Class MyWindows Friend MyPlace As

View 4 Replies

VS 2008 Using LINQ With Collections And Strict On?

Mar 20, 2009

I've been having this niggling issue that's been driving me nuts. Maybe there's something I'm not doing quite right, I don't know. I'm hoping someone with more experience on the subject can show me a better way or just confirm this with a "Jenner, you're not nuts, that's just the way you need to do it".The problem is this. Every time I try to use LINQ to enumerate a Collection, and for this example, I'll use a Collection of TreeNodes in a TreeView control; I get an error of:

Option Strict On disallows implicit conversions from 'Object' to 'System.Windows.Forms.Treenode'.
for the following

[code].....

View 3 Replies

Permanently Store String/object?

Apr 23, 2011

I need to permanently store a string or maybe a object in my application. And yes, I have tried the application settings (My.Settings).

My.Settings.something = "hi" will save "hi" into something, and when i use msgbox to output the data, it works. The thing is; when I copy my application to somewhere else on my computer it is gone. I guess the settings is saved to some file at the filesystem, and when I move my file it also creates a new settings file. How can I store a string inside my application, and also move the application later on?

View 2 Replies







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