Return Multiple Values From A Function?
Mar 30, 2011
Is it possible to make a function that returns both a datatable AND a list(of custom class) at the same?In my GUI layer, the main form (the application is MDI) calls this function and it has to fill the datagrid on one of its child forms and it also has to fill lot of other child forms with various information that is calculated from my custom class properties.Both the datatable and the class properties are created from the same external database and that's why I don't want to have two separate functions.
View 3 Replies
ADVERTISEMENT
Mar 15, 2011
I have created a function that takes a Car Registation as its argument and I want it to return 3 values (Make, Model, Price and of course True).The code itself works fine (it returning each Individual value but can't find a way to get ALL of them from 1 function) However I need to actually return all 3 values, and I cannot see how to do this with a simple function.
View 8 Replies
Jun 10, 2011
When I click on button1, employee_id and P values need to be transferred from button1_click to Cal_Category13() and go through all the calculation. After the calculation, udtnew.X and udtnew.MTD values need to be transferred back to button1_Click
I've no problem to return multiple values Cal_Category13().MTD and Cal_Category13().X from Cal_Category13() to button1_Click but i've no idea how to transfer employee_id and p values from button1_click to Cal_Category13().
Program Code
Public Structure PCB
Public Employee_ID As String
Public MTD As Decimal
[Code]......
View 2 Replies
Mar 26, 2012
i want to get two output values in one Function is't possible ?i am just using String data type and split the values.but have any other easy way to get two output values actually i want to checking a folder how many jpg files are Horizontal and vertical [code]finally i split the values with "|" character.have any other options to get two values as separate in one functions.i have no moew idea about Dictionary,
View 2 Replies
Feb 3, 2010
[size="5"]How can I return two values from the same function?? I need to return an arraylist and an integer...the arraylist is already returning now i need to add the integer
View 3 Replies
Aug 19, 2009
I'm having trouble with a function returning two values. Each value contains a string, how can I return these values and have each one of them be stored in one independent variable. [code] I'm trying to return the hashed text with the salt and the generated salt, how can I do this?
View 18 Replies
Mar 26, 2012
i want to get two output values in one Function is't possible ?.i am just using String data type and split the values.but have any other easy way to get two output values
View 1 Replies
Mar 13, 2009
I want to go to a class.vb file that has a function from an aspx page and I want to return mutiple arrays. Is that possible? If so, how would I call it from the aspx page and how would I return it?
View 1 Replies
Nov 10, 2009
I modified a function that returns a strongly typed Ilist of products (from a web search form) from a stored procedure. Because of the complexity of the stored procedure I have changed it to return productcategories as well using the product results. I can get this into another strongly typed ilist but for the life of me I cannot return the two ilists.
Unfotunatley I ran out of talent, after reading hundreds of posts, It seems it's possible with linq, but I would rather not go that way as I have even less knowledge there. Is it possible put the ilists into a collection of some sort and return them for use as ilists?
[Code]...
View 5 Replies
Feb 17, 2012
So you know how PHP internal functions usually return a boolean FALSE when a function fails, or some other data type when the function succeeds? Is this possible in VB .Net?For instance, lets say this simple code here Public Function TrySomething(ByVal Param As String) \what would go here??
[Code]...
You see I want to return a BOOLEAN false when a function fails, and a string when the function works. I've looked everywhere, and when I search for "return multiple types" all i find is Tuple.
View 4 Replies
Nov 21, 2011
> Function LoginPass() As Boolean
> Dim LogPass As New waxClass
> Dim Ldt As DataTable = LogPass.LoginPass(LCase(UserName_TextBox.Text),
> LCase(UserPass_TextBox.Text))
[Code]...
When I try to use the above function it gives a Warning saying:
Function 'LoginPass' doesn't return a value on all code paths. Are you missing a 'Return' statement?
View 1 Replies
Apr 10, 2012
how to store or return multiple queries result values into multiple variables.. I'm using a query that return 4 columns but how to.. individual store those results into 4 separate variables.. here is my code
Private Sub FrmAlumnos_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtCurrentUser.Text = Login.txtUser.Text
Dim strsql As String
[code]....
View 3 Replies
Nov 18, 2009
currently, I use this code:
[Code]...
View 10 Replies
Feb 11, 2011
I am new to working with XML and have a question. I can recover any one value from an XML file but how do I recover 2 values from the same file and align them into a column format.
This is what I have been doing so far:
Dim doc As New System.Xml.XmlDocument
doc.Load("C:a_xmltestingDev_Clean.xml")
Dim list = doc.GetElementsByTagName("product") 'this returns the product ok
Dim list2 = doc.GetElementsByTagName("product_code") 'this returns the product code ok
I can pass either list into this and recover the values but not both
For Each item As System.Xml.XmlElement In list2
Debug.WriteLine(item.InnerText)
Next
Can I pass 2 GetElementsByTagName into a list?
View 4 Replies
Mar 17, 2009
I am working on a project I would like to use a function in a class I created to return multiple values in order to populate a listbox. I wanted to use a do until loop to achieve this. I will just post a simplified example of what I am doing :
Public Function Listboxfiller
Dim astring As String = "This is a string"
Dim Counter as integer = 0
Do until Counter = 5
return astring
Counter += 1
Loop
Then on the form I would do something like :
lstListbox.Items.Add(Myclass.Listboxfiller)
What happens right now is that the listbox only gets the first value, when I ran through in debug mode I found the loop only runs once, even though it should go multiple times.
View 4 Replies
Apr 1, 2010
I have an active directory search function:
Function GetAdInfo(ByVal ADDN As String, ByVal ADCommonName As String, ByVal ADGivenName As String, ByVal ADStaffNum As String, ByVal ADEmail As String, ByVal ADDescription As String, ByVal ADTelephone As String, ByVal ADOffice As String, ByVal ADEmployeeID As String) As
[code].....
View 1 Replies
Sep 6, 2011
show me how to return multiple values from a function? I have my function in a seperate file within App_Code and here it is:Public Function GetQuoteStatus(ByVal QuoteID As String) As String
Dim quoteStatus As String
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Try
con.ConnectionString = ConfigurationManager.AppSettings("quotingSystemConnectionString")
con.Open()
[Code]...
However this is all good and well for one returned value but what If I wanted to return multiple values.How do I access them?
View 3 Replies
Jan 25, 2010
I want to group items from a linq query under a header, so that for each header I have a list of objects that match the header title. I assumed the solution would be to use ToDictionary to convert the objects, but this allows only one object per "group" (or dictionary key). I assumed I could create the dictionary of type (String, List Of()), but I can't figure out how to write it. As an example I have written a simplified version below.
[Code]...
View 2 Replies
Sep 8, 2010
Row1
;W910 RF3500AA ;Increase volume by 40 db ;(c) summer ;(p) horse +1000000 F5 000000 5555 44 555555 904938291 8676859 00
Row2
;W910 RF350011 ;Increase backlight by 50% ;(c) winter ;(p) vistar +1000000 F5 000000 5555 44 555555 904938291 8676859 00
Row3
;W910 RF350022 ;Increase backlight by 100% ;(c) spring ;(p) spaceman +1000000 F5 000000 5555 44 555555 904938291 8676859 00
Row4 (Duplicate of Row3)
;W910 RF350022 ;Increase backlight by 100% ;(c) spring ;(p) spaceman +1000000 F5 000000 5555 44 555555 904938291 8676859 00
if label1 = RF350022
label2 = Increase
label3 = spring
label4 = 100%
only if it contains all of these words it should return the first instance (row3) then end or null the rest (row4).how can i get row 3 to show in message box now it has been found?
View 5 Replies
Feb 27, 2011
visual basic 2008 express
access 2007 db
I am attempting to fill a form with multiple rows from an access table based off of a parameterized query. My query works fine but I don't want to return one row at a time, I want to return all rows that match my query in multiple text boxes. I know that I can use a datagrid view to accomplish this, but I would prefer the look of a textboxes on a form. I have read through many books and searched the internet forums but think I may just not know what to search for as nothing has worked yet. Can anyone point me in the right direction. So far I have tried setting the text box value to the row().item(), creating a different dataset for each row, and even setting variables for the results of the query to then be passed to the text boxes. Since none of this work, I don't really have any starting code to post. If I could just get a starting point I could work from there, so don't feel the need to code anything for me, just set me in the right direction.
View 3 Replies
Mar 3, 2011
Just so it's known, this question is mostly academic, even though I tried to use the concept in a real-world solution. I realize the example is contrived, but I believe the concept is valid.I want to write some fluent code like this:
[code]...
I realize that I can't force an anonymous type into a specific type (like implementing an interface or some other class), and I don't want the overhead of defining a specific class just to match my desired fluent name with the actual method name. So I was able to make the code work like this:
copy(my_first_file).to.Invoke(my_second_file)So there is no IntelliSense or type awareness there, and I have to include the Invoke in order to have the method run. How can I get more type safety and exclude the Invoke method, under these constraints: Anonymous Type returned from Method No additional classes or interfaces Preferably, I do not want to pass in another parameter to the copy() method that tells what type to return, unless copy becomes a generic method (but I think that means defining another class/interface, which I don't want to do)
View 3 Replies
Dec 13, 2011
I need to execute a stored function in oracle or sql through vb.net. I created a command object. Depending on the database type(oracle or SQL) i am preparing the Command text as Select functionName(?,?,?,?,?,?,?,?) from dual; (For Oracle) Adding the parameter values of the function. Now performing the ExecuteScalar which is not working saying invalid parameter. This works with ODBC connection string. But ODBC doesn't with 64bit. My Requirement: Code should execute a user defined stored procedure by taking the values at runtime.
View 1 Replies
Apr 21, 2009
I have simple columns and their respective sums. However, I exclude 1 particular value from each sum, like so [code]...
Now I need to exclude another value ("Awaiting Progression") from a second column called "PROGRESSION".
Since I already exclude value based on 1 column called CATEGORY, how do I change my =Sum(Code.ExcludeOthers(Fields!CATEGORY.Value,Fields!ACTION_PLAN_NEW.Value)) to exclude a value from the PROGRESSION column if it's = ("Awaiting Progression") ?
i.e. How do I exclude multiple values, depending on values in 2 columns in SSRS 2005?
View 1 Replies
Jun 15, 2011
Possible Duplicate: VB.NET Function Return If I have a function that returns a boolean, what is the difference between:Return False and Function = False
View 2 Replies
Feb 12, 2010
take a look at the following Code:
Private Sub btnDebug_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDebug.Click
Dim d As Date
[Code]....
The Funtion ZZNull always returns Nothing, so IsNothing(d) in the calling method should evaluate to True.
But it does not !
When you run these lines, then you will see that IsNothing(d) evaluates to False
View 7 Replies
Jan 14, 2012
In the documentation of FileInfo.Create Method it says:
'Declaration
Public Function Create As FileStream
'Usage
[code].....
View 7 Replies
Mar 8, 2009
So the program I am writing validates the controls on the page on button_click.
I want to write a function which checks which step the program is at (0-7) then return something depending on whether or not it validated.
My plan was to return the control which was not valid.
Private Function ValidateInputs() As Control
Select Case wizardStep
Case 0
[Code].....
1. could I return the names off all the controls which did not validate?
2. should I be returning a control type or would something like a string be better?
View 3 Replies
Mar 1, 2012
One over time hours and one week's pay @10 hourly pay. I wanted to display those two in two listboxes 1 and 2.
Public Class Form1
Dim overTimeHours As Double
Dim weekPay As Double
[Code].....
View 4 Replies
Jun 2, 2009
how return four value from a function. In general function will return single value but here i am going to return four different values. If possible please tell me how to store the function return values.
[Code]...
View 4 Replies
Oct 5, 2010
I've created my own version of HexToDec() to properly handle the negative flag. I saw other versions online that used "Not(value)" to do the Pos/Neg inversion, but that does not generate the proper value... No, it's not the most elegant my any means. But I couldn't find anything online that actually worked.
Long story short, I want to return NaN in the case that the function is passed a string that is not a valid hex string...
How do I do that? Everything I've tried generates a compiler error... (assign return value to double.nan, assign return value to non-numeric, etc)
Existing function is below:
Function HexToDec(ByVal hexStr As String, Optional ByVal signed As Boolean = False) As Long
Dim lngFinal As Long
[Code].....
View 11 Replies