A Way To Do A .Where(function(x) X.id In [array])?
May 15, 2012
I want to filter a list of entities that I am fetching from a database. In fact, I should be getting only 1 entity back and I want to make sure its category is one of the allowed ones. What's the best way to filter? My first thought was to do something along the line of :
[code]...
Of course, it doesn't work and I'm having issue finding documentation on that "Where".
View 1 Replies
ADVERTISEMENT
Mar 4, 2012
I am creating a dll with all the functions and subroutines that I use all the time and I decided to create a function that I can pass different types of array to so the function obviously (or not) would have an array of type object. Now I no you can pass any type into an object type but when I pass an integer array into an object array I get an error.
value of type '1-dimensional array of integer' cannot be converted to '1-dimensional array of object' because 'integer' is not a reference type.
Shared Function CompareArray(ByVal FirstArray() As Object, ByVal SecondArray() As Object, Optional ByRef ErrorMessage As String = "") As Boolean
Dim IntArrayOne() As Integer = {1,2,3,4,5} Dim IntArrayTwo() As Integer = {1,2,3,5,6} Dim IsSame As Boolean = False IsSame = CompareArray(IntArrayOne(), IntArrayTwo())
View 2 Replies
Nov 1, 2011
I previously posted a Question about code that uses a function to return the frequency of characters in an array. I have now got this code.
View 5 Replies
Mar 30, 2011
I'm trying to call an array from another function into an argument command for a command prompt, but I have no clue on how to do so.This code is the code where I am calling the command prompt and adding arguments
Private Sub ConvertButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConvertButton.Click
Using m_Process As New Process()
[code].....
View 2 Replies
Apr 22, 2012
I would simply like to know if it is possible to call a function using a string value.
As an example i have many functions called "openford","openvauxhall","openmini" etc.
So what I mean is, can I put all those function names into an array, then pull a name from the list and call it.
View 7 Replies
Aug 5, 2011
Before adding rows to a table I am evaluating the SSN number. These will later be flagged for correction so I am setting a datatable column to true or false if it passed muster or not.
I wrote a function to check the number and make the determination plus pad it with zeros and hyphens where they should be. My problem is I want to return the results in an array. I am getting system.string[] as the return value.[code]...
View 14 Replies
Jun 1, 2010
I'm trying to write a function that returns an Array that I can pass into a String.Format[code]...
View 3 Replies
Jan 5, 2010
I need to get the bytes from an array of bytes starting at a certain index and for a certain length (4), how can get this? Note: I don't want to use the Array.copy sub as it is not a function.I need to put it in something like Sub MySub([arguement as byte()]the_function_I_Need(Array, index, length))
View 2 Replies
Nov 20, 2009
I want to pass the entire array to the next function[code]...
View 3 Replies
Jun 12, 2009
i need to pass array value to a function , here are the details
function MyTest(byval a as integer, byval b() as string)
if b is nothing
msgbox("no array")
[Code]......
View 3 Replies
Nov 4, 2011
I want to return an array from a function.dt is a DataTable that is global
HTML
Dim dr As DataRow
For x As Integer = 0 To adoc.GetUpperBound(0)
dr = ds.Tables(0).NewRow()
[code].....
I'm definitely missing something here. I am trying to return an array forn the sql statement, chich I can reference as abom() in the original source.The ultuimate goal is to manually populate dt.
View 14 Replies
Apr 14, 2009
I need to return an array but the array size will change from one call of the function to another so I need away to storing the returned array. The function is as below, and as you can see the returned array will be of different sizes:
[Code]...
View 4 Replies
Jan 15, 2010
Im overiding getRolesForUser() I have 2 columns i return from the query IAdapter.GetRolesByUserName(userName) returns two columns (roleID, formID) How can I return them and access the two columns data? 2 dimensional array?
[Code]....
View 6 Replies
Nov 21, 2009
Is it possible to use a recursive function on an array
If I have an array like this[code]...
I want to use a recursive function to make in out like this[code]...
View 4 Replies
May 3, 2012
I'm trying to write a function that returns an Array that I can pass into a String.Format:
Public Function ToArray() As Array
Dim vals As New ArrayList()
vals.Add(Me("district"))
[code].....
View 2 Replies
Sep 8, 2010
I've written a short function for array intersection and wanted to know why one function is faster than the other.
1)Dim list2() As String 'Assume it has values'Dim list2length As Integer = list2.length
[Code]...
View 3 Replies
Aug 31, 2009
Is it possible to get the arguments from a sub or function in vb2005 as an array?
View 4 Replies
Feb 6, 2012
I have a Sub with an array of strings as parameter:
Private Sub des(ByVal array() As String)
Dim i As Integer
For i = 0 To UBound(array)
[code]....
When I call the function inside my main function , the value of str changes even if the array is passed to the function Byval
Dim str() As String
str = {"11111", "22222", "33333", "44444", "5555", "66666"}
des(str)
I tried making a copy of the array in the Sub, but it still changes in the main function
Private Sub des(ByVal array() As String)
Dim i As Integer
Dim array2() As String
[code]....
I read on a site that you cannot pass arrays ByVal ,is this true? If so , how should I proceed?
View 3 Replies
Dec 24, 2010
I downloaded VB Express 2010 and trying to access a variable array I created in the main form1 private section in another form / function. [code]...
View 3 Replies
Jun 23, 2011
I am trying to call the method with the following declaration[code]...
The structs should both be twodimensional arrays with indexes of 4,4 and 5,4 respectively. The second one is an out parameter.
View 1 Replies
Apr 24, 2012
I've this code, but there is a problem with setting values. I get "null object" error. how to work properly with functions.
Public Structure Results
Dim Nickname As String
Dim Result As Integer
[Code].....
View 5 Replies
Aug 7, 2011
how is the best to store cards? I tried to use array, but I couldnt find simple function to remove one element from array (like in PHP unset() ),
View 1 Replies
May 20, 2010
Dim oList as new Hashtable
oList.Add("1","Value1")
How can I create a a function to return my objects like the above one.
[code].....
View 4 Replies
Oct 26, 2009
I am in the process of using a two-dimensional array to find wind chill factors. My application uses a nudTemp for temperature and nudWind for Wind Velocity. When temp and wind are chosen from the nud list, it is supposed to display the wind chill temp in a text box and then display a message box. Right now it does everything it is supposed to do except that it does not display the proper wind chill factor.
I know it is an issue with my arrays so I was provided with an example but I don't know how to modify it so that it matches my code. I have added all of the array values but it is naming the array variables I am having issues with.
Sample code I was provided:
Private arr1 As Integer() = New Integer() {10, 20, 30}
Private arr2 As Integer() = New Integer() {100, 200, 300}
[CODE]...
I have provided my code as I have it thus far, listed below.
Option Strict On
Public Class frmWindChill
Dim intWindChill(7, 5) As Integer
[CODE]...
View 1 Replies
Mar 3, 2012
Im having a very difficult time trying to pass an vba array ive built from ms- access vba to a .net function.I don't have a com problem I can reference the library just fine from vba but and i can call a simple function from vba. however my problem exist when i attempt to try to pass an array to the vb.net function. vb.net code
View 3 Replies
Jul 17, 2010
i am using XML as database, so updating or inserting diffrent XML's currently i am manage a seprate class for seprate XML file, this process consuming my lot of time, i want to create a genrelize class. currently according to the XML need i am sending two, three, four or five parameter in my function.
now i want to send array of the parameter to my function, so becoz of this thing i could mange all of my functions via a single class...
i am sending u the example what currently i use now...
Public Function Update(ByVal Item_ID As Long, ByVal ProductName As String, ByVal Price As Long, ByVal Path As String) As Long
Try
[Code].....
View 2 Replies
Oct 29, 2010
I have a multidimensional array (not jagged array) that saves data from rows and columns of an excel spreadsheet. After it completes recording the data from Excel, I need to pass the array to another function.I understand how to pass a jagged array, but not a true multidimensional array.
Can someone point me in the right direction? I've done some searching on this site, and others, but most of the info only includes single dimension arrays or jagged arrays.
View 1 Replies
Dec 7, 2010
I would like to pass array to function as parameter. Here is an example for variable that is not array:
[Code]...
View 5 Replies
Mar 1, 2012
Im having a very difficult time trying to pass an vba array ive built from access vba to a .net function. I dont have a com problem I can reference the library just fine from vba but and i can call a simple function from vba. however my problem exist when i attempt to try to pass an array to the vb.net function. vb.net code
<ComClass(ComClass1.ClassId, ComClass1.InterfaceId, ComClass1.EventsId)> _
Public Class ComClass1
Public otag As String()
[code].....
View 1 Replies
Jun 25, 2010
I have a simple VB.Net Form that acts as an interface to a control library with a public API.
One of the API calls takes an Array of UIntegers ByRef:
Public Function Get_Values(source_id As Byte, first_value_address As Byte, number_of_values As Byte, ByRef valuesOut As UInteger()) As Integer
After the call, valuesOut will hold a list of values number_of_values long from source_id starting at first_value_address.
There is a hardware driven limitation that the max number of values returned is 15 regardless of requested length. I need to get 28 values into an array from my VB.Net code.
Is it possible to send only part of an array variable to the function similar to this C code?
uint[28] values;
Get_Values(0, 0, 15, values);//get first part
Get_Values(0, 15, 13, &values[15]); //get second part of data
View 3 Replies