Extension For Dataset Returning List Of Objects
Apr 6, 2010
I want to define a function similar to:[code]My current definition is having an issue with the following statement:GetList = (From x In oDS.Tables(0) Select New T(x)).ToList.I can't figure out how to get to create a New object of type T, any suggestions?
View 2 Replies
ADVERTISEMENT
Mar 24, 2011
I have two lists declared as follows:
Dim lstDBItems As New List(Of DBItem)
Dim lstAppItems As New List(Of AppItem)
I am trying to do something like this:
I've a function which returns List(Of AppItem):
Function GetAppItems() As List(Of AppItem)
'...
End Function
In the above function I populate lstDBItems and then write the return statement like follows:
Return lstDBItems.Select(Function(x)
dim oItem As New AppItem()
oItem.Property1 = x.DbProperty1
[Code]....
The weird thing is the code compiles, but on rumtime I get a type case error.
View 3 Replies
Mar 22, 2012
I want to return an object from a Function. I have used "set" as I should. However, I cannot access the damn object when I return it! Here is the code.
Function GetDPListforPkg(Byval PackageID)
Log "Getting list of assigned DPs for Package " & PackageID
Dim DP, DPs, loc, WBemServices
Set loc = CreateObject("WbemScripting.SWbemLocator")
Set WbemServices = loc.ConnectServer(strCentralSiteSvr , "rootSMSsite_" & strCentralSiteCode)
Set DPs = WbemServices.ExecQuery("Select * From SMS_DistributionPoint WHERE PackageID='" & PackageID & "'")
Set GetDPListforPkg = DPs
[Code]...
View 2 Replies
Sep 13, 2011
The following line of code return several InternetExplorer objects even though I have only one browser window open (no tabs) and only one iexplore.exe process running. How do I only get the open browser window object?For Each ie As SHDocVw.InternetExplorer In shellWindows
View 1 Replies
May 3, 2012
i have issue returning a list in a web method. here is the code
<WebMethod()> _
Public Function getTags(para_parents As String) As List(Of getTypeDetailsByParentName_Result)()
Dim context As New PPEntities
[code]....
the error is
Value of type 'System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)' cannot be converted to '1-dimensional array of System.Collections.Generic.List(Of SaftyonRoad.getTypeDetailsByParentName_Result)'
View 1 Replies
May 8, 2012
I have a combo box that is "linked" to dataset.
I have a Label that I want to return the value from 'Description' Column from 'Base' Table.
This is determine when user has chose a value from the combo box which is linked to the 'Base' Table from 'Material' Column.
View 1 Replies
May 23, 2012
That was probably bad title, but I'll illustrate what I'm trying to do. I have a method in a class that I need to call several times. The method returns a List(Of String). I'm just grabbing some information from a database.
VB.NET
Public Function GetTestList() As List(Of String)
Dim int As Integer = 0
[code]....
View 4 Replies
Jan 11, 2012
Public Sub checkemail()
sqlcheckemail = "select Email from WEBUSER where Email='" + TBEmail.Text + "'"
Dim dscheckemail As New DataSet
[Code]....
if u see the one that i've commented is the one i already googled at tested...so now if the email address exist in the db..everything works wonderful..but if it doesn't exist the code should process the one that does not satisfy the first if statement...but now i'm getting the result as "There is something" eventhough the email does not exist in the db...
View 2 Replies
Dec 15, 2011
I cannot seem to figure out how to search through a created/filled dataset for a certain value which exists in column(1), returning Column(0)'s value into a textbox.My code looks like this:
[Code]...
View 4 Replies
Jun 25, 2009
I have a strongly typed dataset that has rows with duplicate [sopnumbe] I am looping through them and displaying row data I want to only display the Distinct sopnumbe rows in my initial loop1.. but the sub loop uses the data out of all rows.. So I cant filter the actual dataset.
[Code]....
View 6 Replies
Feb 24, 2011
I have a school project i am working on wich i am to build a program that randomly generates 500 alpha-numeric numbers (license plate numbers). the program needs to be able to search the 500 numbers and based on given criteria (a text box) that you put in return the matching results to another listbox. I got the 500 plate numbers to generate on form load but have been searching thru my textbook and cant seem to figure out how to take the imput from the text box and search the list box. Not asking for a ton of help but just a point in the right direction. i attached the assignment i was given from instructor.
[Code]...
View 5 Replies
Jul 29, 2010
I have two functions in a class. One function returns a datatable, the other one returns a dataset. Both functions are identical except of the return type (Datatable or dataset). I would like to have only one function which returns either dataset or datatable depending on what the user of the class wants. How can I do this.
Following code shows my function returning a datatable:
Public Shared Function ExecuteSPDatatable(ByVal storedProcedure As String, ByVal ParamArray parameters() As SqlParameter) As DataTable
Dim tbl As DataTable
[Code].....
View 11 Replies
Mar 2, 2010
I'm trying to get VB6 to access an Oracle (9i) procedure and return a dataset without much success.Not used VB6 that much but I need to do it for this application as we are not able to install the .Net framework on this particular server.Oracle procedure has an input param and an OUT param which is defined as a sys_refcursur
CREATE OR REPLACE PROCEDURE "LOGMNR"."LM" (p_filename in
varchar2, p_recordset OUT SYS_REFCURSOR)[code].....
I get the same error message regardless of wetheror or not the second output parameter is enabled.3709 The connection cannot be used to perform this operation. It is either closed or invalid in this context.how to return a recordset from Oracle to VB6?
View 3 Replies
Feb 3, 2012
I am trying to populate a combo list box with the results of a web service. The web service returns a dataset with two columns. I want to display column one to the user and capture column two with the user selection of an item from the combox.right now I can display the first column and capture the selection.Not sure how to add the connection of column two, to the combo box and capture the selection
Code so far....
myDataSet1 = proxy3.listSuppLang()
Dim x As Integer
[code].....
View 1 Replies
Jun 2, 2011
I would like to create list of child objects from list of parent object. Like If i have list of bookingroom which has one member room then i would like to create list of room from it.
eg. code:
Dim BookingRoomList As List(Of BookingRoom) = New List(Of BookingRoom)
Dim RoomList As List(Of Room) = New List(Of Room)
BookingRoomList = BookingRooms.FillGrid()
[Code]....
Is there any short cut method instead of iterating over for earch?
View 1 Replies
Jul 20, 2011
I'm having a bit of a 'brain doner' moment here
I have a list of Objects. Each of these Objects contains a list of other Objects (pseudo code) :-
Private Structure Object1
dim Name as string
dim ListOfObject2 as List(Of Object2)
[Code]....
I need to sort the list of Object1 by the Value in Object2. I have a comparison class which sorts Object2 by its Value nicely.
View 13 Replies
Dec 22, 2010
I have 2 classes
Public Class Shipper
Public Property ShipperID As Long
Public Property CreateDate As DateTime
[Code].....
View 1 Replies
Nov 23, 2011
I'm trying to create a list of days(integer) from a list of dates(date).
I tryed to do this....
[Code]...
View 4 Replies
Aug 18, 2010
What are the various objects in Dataset ?...
View 2 Replies
Aug 26, 2011
I want to create a extension class for the List type so users can do [code]I've it defined as Type and also tried object but neither are accessible when I have a list of strings.If I set it to be string it then appears..But I want something that is more generic and will work with all lists. How do I need to define it?
View 1 Replies
Sep 30, 2011
I'm working on a small game that is based on a map of grid squares.I have a class (clsGrid) that stores a few properties for each grid square.The grid square objects are organized into a list(of clsGrid).A loop and stream reader are successfully reading properties from a text file, putting the properties into grid objects, and adding the grid objects to a my list of grids. When retrieving a grid from the list of grids, I'm getting unusual results. Regardless of the index I give the list, I always seem to get the last indexed grid in the list.The debugger seems to suggest that the right numbers are being read into the stream reader and they are being added to gridHolder. However, the message box at the end will always show me the LAST grid.id, regardless of the index I give it.
'A subroutine that generates a map (list of grids)
Sub GenerateMap()
Dim reader As StreamReader = File.OpenText("map1.txt")[code]....
View 1 Replies
Mar 14, 2012
I sometimes come across patterns or common practices that I do not agree with. I have a clear opinon of what is considered "good design", which is mainly based on my understanding of abstraction and creating layers.IMO, the core of an application is it's object model. It's a hierarchic model where one object references other objects or lists of them. That's a memory-internal model. For example, a house object references a list of rooms referencing lists of furniture.An object is identified by it's reference. There are no IDs or PKs in that layer.Saving/Loading data is an additional feature. Sure, no application will do without, but it's based on top of the core of the application. I could write an application that works very well without loading/saving, and for version 2 I will think about whether to save data to a database or an XML file. Merely this fact proves that a database layer is not the lowest. I've never agreed with that three-tier model - even if you call me unteachable.
In addition to all application objects, there are Datasets - and that's my problem now. They can be considered as a copy of what is already present in the application's object model. Its from a different, table-oriented view. As both structures exist in parallel, there's the need to synchronize the DataSet with the (rest of the) application's objects.That's the task that I am always struggling with, and I ask how you handle it. I know this is a major design question but, fortunatelly, I could quite get around this problem so far.The only solution I can imagine is maintaining additional relation lists. For example, whenever the property of a room object changes, that change must be reflected in the associated DataRow in the DataSet. For this purpose, I need a look-up table that tells me the PK of the given room in the database. It requires a lot of additional efforst to do all the synchronization.Again, the house or room object itself does not have a PK and it won't get one because on that layer, it doesn't even know that a database exists.
View 11 Replies
Jan 24, 2010
I need two seperate lists, which every item is Integer, String, Bitmap - and one which every item is Integer, String String. However I don't know how to do this, or even where to look - I've googled for custom objects and custom object lists. What I'm trying to do is this.Custom Object1 is Integer, String, Bitmap Custom Object2 is Integer, String, String
In one thread I'll be adding items to List1(Of Object1), and processing them, and adding the results to List2(Of Object2), however I need to be able from other threads to look at the list and say only give me the items where Integer = (my thread ID), is this possible? Any help, or even links to information that would be relevant to this request would be helpful?
View 2 Replies
Mar 11, 2009
Any best approach to what I'm trying to achieve (linq to sql, returning list of data to show in a grid/list etc etc)... Its complaining about anonymous type conversion, and from what I'm reading, thats not elegant way of doing it.
Public Function GetHistory(ByVal historyId As Integer) As List(Of ?????????)
Using dc As New myDataContext(Application.GetConnection)
Return (From t In dc.ActionTypes, a In t.MyTable Where a.HistoryID = historyId Select a.ActionOn, a.ActionBy, t.Description, a.ImpactedItem, a.ActionDescription).ToList
End Using
End Function
View 4 Replies
Sep 29, 2011
I have a Business Logic Layer that contains function that return datatables. I'm writing a function that will return just the records that begin with the string passed in. this is what I've come up with so far:
Public Function FetchBusinessAreas(ByVal area As String) As List(Of BusinessArea)
Dim AreasList As New List(Of BusinessArea)
Dim dt As DataTable
[code].....
View 2 Replies
Oct 5, 2009
A quick question on caching dataset objects. How can I know if the data is changed in Sql when caching data? I don't want to specify time constraints but used a strategy where data is changed in sql and I have to refresh my cache?
View 1 Replies
Oct 16, 2010
have a lot of experience with LINQ, but should your verb be attached to the array?
data.Tables("people").LoadDataRow(parsed(int1, 1), True) S/B
data.Tables("people").LoadDataRow(person.parsed(in t1, 1), True)
View 1 Replies
Dec 16, 2010
I have a custom list that inherits Generic.List and it has a method for deselecting all of the members named DeselectAll It has looked like this for a few weeks and has worked fine.
Public Sub DeselectAll()
MyBase.ForEach(Function(p As Publipostable) p.ModeEnvoiChoisi = Nothing)
End Sub
Today, it stopped working ?!? I reverted to an earlier version using delegates and that works fine...
Public Sub DeselectAll()
MyBase.ForEach(AddressOf DeselectModeEnvoi)
End Sub
[code]....
Edit: Stopped Working meaning it no longer sets the property p.ModeEnvoiChoisi to Nothing on each item in the list. The DeselectAll method gets called, but all the items retain their previous values...
View 1 Replies
Mar 8, 2010
I have got an xml document which looks something like this.
<Root>
<Info>
</Info>
<Info>
[Code]...
How can i write a linqToXML query so that it returns me an IEnumerable containing each child element, in this case all five child elements of , so that i could iterate over them. The order of child elements is not definite, neither is number of times the may appear.
View 1 Replies
Mar 29, 2012
I am trying to call an external C++ function using VB.NET (answers in C# are fine, I can convert back) which returns a list of device names. This comes in the form of a pointer to a null-terminated array of null-terminated char arrays (correct me if I've misunderstood what I'm dealing with) with a function signature:
long GetNames(char*** names)
Most of the answers to similar questions I've found have involved something more like:
long GetNames(char** names, int length)
It appears from what I've read that I need to give it an IntPtr but I'm uncertain as to how this should be initialized, and in my case I don't know the length of the array. At the moment, in the VB module, I have:
<DllImport("MyExternal.dll", CallingConvention:=CallingConvention.Cdecl)> _
Function GetNames(ByRef names as IntPtr) As UInteger
End Function
I've tried calling the function by passing an IntPtr initialized as IntPtr.Zero or using Marshall.AllocHGlobal, but I always get an AccessViolationException.
Any ideas on how I should be calling this function and how I get the return value into a managed string array would be greatly appreciated.
EDIT: I've found a sample function call in native C as follows:
char **tmplist;
GetNames(&tmplist)
View 2 Replies