Returning Multiple Values From A Function Call?

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


ADVERTISEMENT

Returning Multiple Values From Function

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

Asp.net - Returning Multiple Values From A Function In An Parcial Class In VB?

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

Returning Multiple Results (UDT?) From An Interop Call - VB6?

May 7, 2012

like an Interop user control (VB.NET) to return and to accept multiple values from a get/set call. I assumed a user defined type (UDT), would be the correct way but I keep getting a "Variable uses an Automation type not supported in Visual Basic¯ from the VB6 compile. How is passing multiple values between an interop control and the VB6 application done?VB.NET (Interop) code, a control with a .NET ListView

Structure Employee
Dim Firstname As String
Dim Lastname As String

[code].....

View 2 Replies

Returning One Or More Values From A Function?

Apr 20, 2010

Is it possible to return more than one value from a function? Like two integers, or an integer and a boolean, or any other data type combination. I understand I could use a sub and set these values in a variable but I was wondering if I could avoid declaring more variables by using a function.

View 28 Replies

Function Is Not Returning Correct Values

Jun 18, 2009

Ok simply my code doesnt want to output the correct number. I'm working on the project euler probems to expand my knowledge in VB.net and the current question I am working on is asking to work with triangle numbers. while researching I found that a triangle number can be calculated by using the formula:

[Code]....

View 5 Replies

Web Services And Returning Multiple Values

Jan 14, 2009

I am struggling here with introducing web services into a site I am currently working on. The background is as follows.

- I have a page switchboard.vb which will recieves incoming xml requests.
- I parse these xml requests extracting its values, then setting them equal to the relevant global variables in switchboard.vb.
- One of these variables will determine a 'requestType'. Based on this requestType I want the page to call particular web services that I will add.
- These web services will then validate the user calling has permissions to access and execute it.
- The switchboard.vb page will then generate an xml respose which will post to the client.

Here is a summary of the process
getXML()
parseXML()
determineRequestType()
executeRequest()
rebuildXML()
postXML()

The ways I can see to do this are:
1. Pass the variables into the required Function allowing it to pass back a pre formatted xml string.
Pro: Simple
Con: It is not really using the web service as it should be.

2. Pass the variables into the required Function as 'ByRef' values hense changing the original value on switchboard.vb
Pro: allows me to format the outgoing xml on switchboard.vb and gives me more functionality with more individual variables as opposed to one string being passed back.
Con: Is this taking advantage of a web service? When I tried this the web service form didnt give options to input test data. Possibly because I am using ByRef?

View 10 Replies

Values Reverting After Function Call

Jun 16, 2009

I have two files. My form and a module with helper functions and the definition for a structure. For some reason, when I call finish_up, which should calculate how much freespace a disk has, the values just revert to their original bytes value. However, if I put a msgbox inside the function, the correct information is displayed. Just not once it goes back to the form.

Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Disks As New List(Of DiskData)
Search_Disks(Disks)
Finish_Up(Disks)
For Each x As DiskData In Disks
[Code] .....

The finish_up sub should go through each diskdata structure, find if it isready, calculate freespace and size down to their proper amounts and then just send it back. I don't understand where the problem is.

View 2 Replies

VS 2010 : Convert A DLL Function Call Which Has The Callback Function Routine Called Within The DLL Function Call?

May 25, 2012

I am trying to convert a DLL function call which has the Callback function routine called within the DLL function call.The DLL function call signature is like this:

typedef void *HANDLE;
typedef HANDLE HACQDESC;
DECLARE_HANDLE (HWND);

[code]....

how to convert this DLL call to VB.NET and also how to create the callback function and send it as parameter to this function
call.

View 15 Replies

Asp.net - Returning "this" In A Function Call?

Mar 4, 2009

I have a function within a class which I would like to return the class itself however "return this" appears to be invalid in VB.I am using ASP.NET v1.1 if that makes a difference?Sample (extremely simplified) code is as follows:

Public Class Cart
Private sItems As String
Public Function addItem(ByVal itemName As String) As Cart

[code]....

View 2 Replies

Function Call Spanning Multiple Lines?

Jan 27, 2010

I have a C# function call which looks something like this:

var res = function ("arg1", // argument# 1
"arg2", // argument# 2
"arg3" // argument# 3

[code].....

View 4 Replies

Function Call For Multiple Textboxes Using Visual Basic Studio 2008

Feb 17, 2010

I am working to make a function that will update the back color of a text box based on multiple variables values. I can write the code to do the calculation, but I am not sure how to make the function realize which text box to update (as I will have about 30 different boxes). Below is the code that I have for each box so far, but I will have quite a few more, and would rather use a function to reduce the amount of code, and also make it cleaner as well.

If sngPreviousPrimaryPropertyTotal >= sngPrimaryPropertyTotalCost Then
txtPreviousPrimaryPropertyTotal.BackColor = ColorProgramLightGreen
Else
txtPreviousPrimaryPropertyTotal.BackColor = ColorProgramLightRed
End If
[Code] .....

Or is there a way that I can tell the function that it's updating the text box that call the function in the first place? Say if txtBox1 has updated text and calls the function, then the function 'knows' to update txtBox1, but will update txtBox2 when it's called by txtBox2.

View 3 Replies

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

Return Multiple Values From Function?

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

Returning A Function Vs. Returning Variable Name?

Dec 12, 2011

My brain may just be fried since it's the end of the semester, but my teacher kicked this back to fix and resubmit...she said that I am "returning the name of your function rather than your variable name".

Here is my code for all 3 forms.

code:

These are forms to calculate the cost of getting a cell phone package.

View 6 Replies

Function Syntax - Call A Function With 2 Arguments When The Function Is Only Defined For One

Apr 1, 2010

I'm trying to undersatnd the syntax of calling a funciton and it seem confusing when I'm using a web service in ASP.net. Maybe this question should be in an ASP forum, but it is a VB question. This simple web service allows you to type in your name and it response with an alert box with you name.

My question is, How can you call a function with 2 arguments when the function is only defined for one. I understand that the second argument is actually a method that handling the respons, but how can you interchange function arguments for methods and how do you know that there are methods for

Here's my call:

<script type="text/javascript">

function HelloWorld()
{

var yourName = $get('txtYourName').value;

[CODE]...

View 7 Replies

ASP.NET MVC AJAX Returning New Page On Simple Call

Jul 15, 2009

I'm not sure what's wrong with the following setup. I have a View that lists a number of records, and each has a dropdown associated with it to change a value on that record. I had it all working without AJAX, but you had to change a bunch of the dropdowns then click a Submit button. I wanted to change it so that it would save the dropdown choice immediately.

My stripped down View (of type IEnumerable(Of MyTable)):

<script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script>
<script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script>

[Code]....

What I would like to happen is for the dropdown change to trigger the Update controller, but probably not return anything - just update the database and let the user move on. What's happening though is that a blank page is displayed with the Content value on it (i.e. "123: ABC"). It's the correct id/code combo, so the Update seems to be firing correctly, it's just choosing to wipe out the html.

View 1 Replies

Call A Dynamic Compiled Func(of ) Function Via Expression.Call?

Mar 22, 2012

I want to create an ExpressionTree where a Func(of Vector, Vector, Vector, Vector, Double, Double, Vektor) should be called. So I use

Expression.Call(Forces(0).Function.Method, {Vec1, Vec2, Vec3, Vec4, Double1, Double2})(Vec1-4, Double1-2 are declared as ParameterExpression and Forces(0).Function as Func(of Vector, Vector, Vector, Vector, Double, Double, Vector). But I get an AgrumentException, because Forces(0).Function.Method has seven Arguments. (System.Runtime.CompilerServices.Closure as seventh argument at Index 0).

View 2 Replies

ASMX Call - Returning Response Header As XML Instead Of JSON

Dec 29, 2011

My ASMX call is returning Content-Type = text/xml; charset=utf-8
I am using ASP.NET 3.5 and jQuery.Ajax. Have added these things are per numerous suggestions from Stack Overflow. I have done these things

Done this at web.config
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
[Code] .....

But whatever I do, the response header is still of type xml. What part am I missing here?

View 1 Replies

Call ADODB.Command.Execute - Not Returning Recordset?

Sep 9, 2009

I have a classic ADO command which execs a sproc and returns a RecordSet. This is being executed from a VB.NET using the PIA.However when I .Execute the command, the result returned is not an ADODB.Recordset but a System.__ComObject.

View 1 Replies

Call SQLServer CLR Storedprocedure From Client Returning A Datatable?

Nov 29, 2010

Call SQLServer CLR storedprocedure from vb.net client returning a datatable

View 1 Replies

Returning A Function Value

Dec 14, 2009

returning a function value? I have a simple function that returns an integer. This function works fine when executed in SQL Developer but, when called from my apps, it always returns 2 regardless of anything. I have checked it over and over again, I cant seems to find where I am going wrong.

[Code]...

View 6 Replies

Returning No Value From A Function?

Apr 20, 2009

what changes I need to make to the code so that when no value for intPosition is found the textbox txtRoomNumber remains blank? At the moment a value is being entered into the textbox when no value for intPosition is found.

Code:
Private Sub btnFindRoom_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindRoom.Click
Dim strRoomType As String
Dim intRoomNumber As Integer

[code].....

View 2 Replies

Call A Function From Inside Another And Suspend It Until The Called Function Is Finished

Jan 25, 2010

How can I call a function from inside another function and suspend the calling function until the called function is finished? I hope I can get some replies because I don't know how to ask the question and make sense:).

Anyway what I am trying to do in steps:

1. The user clicks button1 which triggers the click event.
2. From the click event I call a function
3. I then pop-up a form, that has instructions for the user to read.
4. After the user has read the form he will click the "Done" button and return to the calling function.

The problem is the the calling function continues to execute. I want to stop execution of the calling function until the users clicks the "Done" button on the instruction pop=up. I know I can use a msgbox but the instructions can be lengthly and does not look good in a msgbox.

I have tried the Call method with return in the "Done" button click but I can make that work. I also tried a goto statement but I can get that to work either. In the call statement I said call frmInstruction.show() and it got there but as I said the calling function continued to execute.

View 3 Replies

Getimage Of Control Function - Call This Function For Saving The Images?

Jan 30, 2010

ive two custom controls, which are used to draw and edit etc...(like paint but customized....) i want to save their images with a single click....So im using the Getimageofcontrol function to do it....its code is below:::

Public Function GetImageOfControl(ByVal c As Control) As Image
Dim rc As New Rectangle(c.PointToScreen(c.Location), c.Size)
Dim i As Image = New Bitmap(rc.Width, rc.Height)[code].....

and the code to call this function for saving the images is simply.. ...

GetImageOfControl(pboxd).Save("c:78.jpg")
GetImageOfControl2(pboxf).Save("c:lp.jpg")

but the problem is that both the images have the same content....

View 2 Replies

Threaded Function Call Slower Than Calling Function Directly?

Sep 14, 2010

I have a function where I am performing a lot number of database operations inside a Sub. The operation when called directly like:ExecProcess()

takes about 11 seconds to run.However, if I create a Delegate, and call the sub using BeginInvoke(), the very same process takes over 40 seconds to execute.Here's the threaded code:

Protected del As ProcessDelegate
Protected Delegate Sub ProcessDelegate()
del = New ProcessDelegate(AddressOf SELocal.ExecJob)
Dim cb As New AsyncCallback(AddressOf Me.ExecJobComplete)
del.BeginInvoke(cb, del)

Anyone know what may cause a function to take longer inside a new thread, rather than calling directly?

View 2 Replies

.net - Function Returning Different Datatype?

Feb 15, 2011

Just come across the following snippet:

Public Function Checked() As Boolean
Return applyChange 'this is a string!
End Function

Whats going on here? How can a function with return type Boolean actually return a string? I'm assuming theres some implicit conversion going on here, which I'd rather not have.

View 1 Replies

.net - Recursive Function Not Returning?

Nov 28, 2011

I am hopeing someone can help me here with a recursive function I have that is not returning either true or false as I would have espected it to. The function loops through a Active Directory group for its members and then calls itself if it encounters any groups within the membership in order to gets its members as well. I am trying to return either true or false based on if any errors were encountered but not haveing any luck at all. It appears to just hang and never return back to the primary calling sub that starts the recursive function. Below is my code I am using:

[Code]...

View 1 Replies

Asp.net - Returning Object From A Function?

Feb 8, 2012

If an object is created inside a function and the function returns that type of oject how is the memory handled.

Example:

Public Function GetEmployee(employeeid as integer) as employee
Dim oEmployee as new employee
oEmployee.FirstName="Bob"

[code]....

Does the variable that receive the object still a pointer to the memory location that was used inside the function?What about when you do a oEmployee2=oEmployee.Is oEmployee2 just a pointer? And any changes to oEmployee will now affect the other. Just trying to understand it from a memory perspective and how that scope works?

View 2 Replies

Function Returning Different Datatype?

Dec 22, 2011

Function returning different datatype

View 4 Replies







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