.net - Function That Takes Other Functions As A Parameter And Executes Them

Apr 29, 2010

Is there a way in vb.net to create a sub/function that will take as an argument some kind of pointer to another function, and allow this new sub/function to execute the passed function? What I have are 10-12 xml-rpc functions I am calling against a remote server. Each of these functions has different argument lists (one takes 1 string, another might take 3 strings and one int, etc). All of them return an object.

[Code]...

View 4 Replies


ADVERTISEMENT

Function That Takes A String As A Parameter?

Jan 1, 2012

I have a function that takes a String as a parameter And in it I have variables, so if I call it it's like

Dim Text As String = MyStringConverter("Hello Mr. " & Name & " " & Surname "!")

View 4 Replies

Method/sub That Takes An Object As A Parameter?

Dec 23, 2010

I have a method/sub that takes an object as a parameter, then it scans through a panels controls and trys to find if it is in the window.

Public Sub removetype (ByVal findobject As Object)
Dim types As System.Type = findobject.GetType
For Each ThisCtrl In Flow.Controls 'flow is a panel

[Code]......

View 3 Replies

Takes A String Parameter And Runs A Command?

Mar 15, 2010

What function in VB.NET simply takes a string parameter and runs a command? It would work just like the OK button in the Start -> Run dialog.[code]

View 3 Replies

Form Must Finish Loading Before The Function Executes?

Apr 6, 2011

I am using Visual Basic 2005. The program I am creating can either bring up a form (with a bunch of buttons, listboxes and a picturebox) and the user can enter file names onto the form OR the user can drag file names from Windows Explorer and drop the names on the program icon to start the program. During the execution of the program, messages are displayed in one of the listboxes.

All this works fine except for part of the drag/drop scenario. When the drag/drop is done, the form is not fully loaded when the code function starts to put out messages. This means the user may not see any of the messages until all is complete. I have tried putting my executable code in the Form1_Shown() and even added a timer to slow things down a little, but nothing seems to work consistently.

View 4 Replies

Calculation Function - Takes The Average (which Is Calculated By A Different Function)

May 24, 2011

To have a function that takes the average (which is calculated by a different function) say for example the average is 6, now the function is to take the number 6 and get the variance from six to another number lets say its 12 so this will return a calculation of 50% variance. now here comes the issue, i have it calculating the variance how ever lets say that there is a score that is 0, how can i make it calculate the variance without taking count for that 0? i guess you can say i need it to "skip" if its a 0.

View 5 Replies

Asp.net - AJAX: Statusbar: Force Update Of UpdatePanel While Function Executes?

May 17, 2010

I have a label inside an update panel which I wouldl ike to use as a status bar.Basically the user clicks a button which executes a main fucntion that performs a series of tasks. I'd like to inform the user as to the state of the function as it progresses e.g.:

Stage 1: Retrieving data...
Stage 2: Calculating values...
Stage 3: Printing values...
Stage 4: Done!

I've tried updating the updatepanel directly from the function but it only updates the panel at the end of function (stage 4) and shows "Done!" (which I understand is how it should work).I've been looking into timers and threads to try and update the panel separate to the main function?

View 1 Replies

DB/Reporting :: CrystalReports Redistribution - Viewer App That Takes A Command Line Parameter

Jul 7, 2009

I created a report viewer app that takes a command line parameter, the report filename, and opens the report. I also created a ODBC File DSN that I want to redistribute. However, currently, the DSN needs to reside in 'c:program filescommon filesodbcdata sources'. Is there a way for the report to look for the DSN in the application directory? Also, what components besides .NET 3.5 are required to redistribute the report and report viewer app?

View 1 Replies

VS 2008 Template Function That Can Receive Different Parameter And A Type Parameter

Mar 9, 2011

I want to have a "template" function that can receive different parameter and a type parameter, like:[code]But Vb told me that tupeList is not defined... is there a way I can do that?

View 2 Replies

Sql - Function Takes Long Time For Execution?

Jun 13, 2012

Actually, I am trying to find out whether the partno is existing in the database table or not and it takes long time in count = checkCommand.ExecuteReader statement

Public Function CheckProductNo(ByVal Partno As String) As Boolean
Dim count As SqlDataReader
Dim valid As Boolean = False
Using connection As New SqlConnection

[code]....

View 4 Replies

Build A Function That Takes The Exact Parameters Of CType?

Nov 2, 2009

what exactly is the type of the second argument of CType

CType(testobject, Control)

what exactly is Control? how can Control be used as though it is an expression?i nid to know this because i'm trying to build a function that takes the exact parameters of CType, let's call it CType2public function CType2 (byref object as Object, byval thetype as Type) as Object problem is when i do this: CType2(testobject, Control) they give me "Control is a type and cannot be used as an expression".

View 6 Replies

Function That Takes ByRef Parameters Using Control.Invoke ?

Nov 10, 2005

I'm currently invoking a function that takes ByRef parameters using Control.Invoke (which I notice specifies the Object parameter array to be ByVal) but the array of parameters I give it isn't updated by the function. Is this possible with VB.Net 2003 or must there be some error in my code?

View 5 Replies

Is Write A Function Procedure That Takes An Array Of Strings

May 9, 2010

I'm a beginner and doing a review for my final...the question is-Write a Function procedure that takes an array of Strings, sorts it using Shell sort and returns the sorted array. I do not get shell sort at all.

View 3 Replies

Make A Function Which Takes A Number Then Does An Operation To It Again And Again Until It Gets A Vlue?

Apr 26, 2009

This is probably a stupid question, but how do you make a function which takes a number then does an operation to it again and again until it gets a vlue which it already has seen, when it returns all of its values? I have this function:

Private Function fractal(d as string) As double
Fractal = Val(D) * (Val(D) - 1)
Fractal = FormatNumber (Fractal, 2)

[code].....

View 4 Replies

Ado.net - Execute A Stored Function In Oracle Or Sql - Adding The Parameter Values Of The Function

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

Multithreading - Threading Function That Takes Variables And Returns A Datatable

Mar 7, 2012

I've been looking at threading to make my webapplications more responsive. I've found out how to thread a sub that takes no variables and doesn't return anything, but I can't find out how to achieve this for a function that takes variables and returns something. here is an example

[Code]...

View 1 Replies

Pass Function (Of TElement / TKey) As A Function Parameter

May 28, 2012

I want to make a GetAllContacts method which takes a sort parameter of type Func(Of Contact, TKey) which is the same type that the OrderBy method for an IEnumerable(Of Contact) takes.[code]"Too many arguments to extension method 'Public Function ElementAtOrDefault(index As Integer) As Contact' defined in 'System.Linq.Enumerable'." on the second parameter.

View 2 Replies

Datatable Getdata Performance - In-line Table Valued Function In SSMS Takes About 6 Seconds To Return 11088 Records?

Mar 25, 2011

An in-line table valued function in SSMS takes about 6 seconds to return 11088 records. The same function in VB .Net 4.0 using TableAdapters.InputTableAdapter.GetData (Created with data set designer) takes about 15 minutes complete.Both are executed from the same workstation.Why does this discrepancy exist?

Workstation:

Windows XP SP3, 2GB

VS2010 Ultimate

.Net 4.0 Framework

Server:

SQL Server 2008

View 3 Replies

Add Description To Functions And Function Parameters?

Apr 19, 2011

I'm writing a VB.NET function with a ton of overloads. I've seen that most .NET functions have parameter descriptions in IntelliSense. For example, when typing in String.Compare(, IntelliSense says Compares two specified System.String objects and returns... you get the idea. This description changes and you click through different overloaded versions of the same functions. When you start typing in something for a parameter, it describes the parameter you're currently inputting as well. Example: strA: The first string to compare..

View 5 Replies

Modify Functions Such That They Can Accept Any Function

May 7, 2011

[[code] 1) Is this violating the phrase static classes should not have state?

2) How can I modify the functions such that they can accept any function (instead of my above situation which only works with F(TResult) and F(T, TResult). [code]

View 1 Replies

Way To View Preset Functions Like Int Function

Nov 16, 2009

Is there a way to view preset functions like the Int() function.

View 6 Replies

VS 2008 : Have A Class Where The Functions Of The Same Name Are Both Instance Functions And Shared Functions?

Dec 6, 2010

What I am trying to do is have a class where the functions of the same name are both instance functions and shared functions.

Public Shared Function Get...(byval xx as xx)

and

Public Function Get...

The Public Function uses a Property xx created in the constructor, whereas the Shared Function has the parameters (byval xx as xx).

View 1 Replies

Asp.net - Calling Other Functions From A Shared (or Static) Function

Aug 20, 2010

I get this error: Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class.

Partial Class _Default
Inherits System.Web.UI.Page
<WebMethod()> _

[Code]....

I know it has something to do with the fact that the first function is shared and the second function should probably be Public as well but I don't fully understand the reason behind it. Probably not relevant but I'm calling the web method from some javascript.

View 1 Replies

Categorizing Functions And Properties In A Function Library?

May 9, 2010

I am currently working on a project witch contains lots of functions and properties. These functions and properties are stored in the dll. If I reference to this from within my project, these functions and properties are all in the same namespace or class. (I don;t know how it is called)Example:If I type the root namespace: Functions. I get all the functions. I would like to organize them in:

Functions.Maths (All the functions involving maths)
Functions.Internet (All the functions involving the internet)
Functions.Language (All the functions involving languages)

I tried using classes but I cant access the properties when they are stored in a class. I don't know why.

View 2 Replies

Mysql Functions - SELECT Statement And Make A Function ?

Jul 12, 2010

I am trying to clean up my code a bit.

I made the following function:

Public Sub sqlUpdate(ByVal table As String, ByVal column As String, ByVal var1 As String, ByVal column1 As String, ByVal var2 As String)
Public CN As New MySqlConnection
Public cmd As New MySqlCommand

[CODE]...

Which is fine, if I want to use mysql update all I have to do is call something like: sqlUpdate("test", "test", 0, "test", test) I was wondering if I could do the same with the SELECT statement and make a function. I cant think of a way to do it though...

sqlConnect()
Dim cmd As New MySqlCommand
With cmd
.CommandText = "SELECT * FROM users WHERE username=""" & lblAccountName.Text & """"

[CODE]...

The data I would want to extract would be different every time.

View 3 Replies

Calling Function With Hex Parameter?

Dec 14, 2009

The following two statements seem the same to me but the first throws a design time error, and the second does not. The first one is passing the first parameter in hex and the second passes the first parameter as its decimal equivalent.

Public Shared ReadOnly Test As New Guid(&HCC58E280, &H8AA1, &H11D1, &HB3, &HF1, &H0, &HAA, &H0, &H37, &H61, &HC5)
Public Shared ReadOnly Test2 As New Guid(3428377216, &H8AA1, &H11D1, &HB3, &HF1, &H0, &HAA, &H0, &H37, &H61, &HC5)

Here is the error associated with the first statement:

Error 1 Overload resolution failed because no accessible 'New' can be called with these arguments: 'Public Sub New(a As Integer, b As Short, c As Short, d As Byte, e As Byte, f As Byte, g As Byte, h As Byte, i As Byte, j As Byte, k As Byte)': Constant expression not representable in type 'Short'. 'Public Sub New(a As UInteger, b As UShort, c As UShort, d As Byte, e As Byte, f As Byte, g As Byte, h As Byte, i As Byte, j As Byte, k As Byte)': Constant expression not representable in type 'UInteger'.

View 1 Replies

How To Pass Parameter For Function

Dec 9, 2009

I have a statement:
dat.XoaNhanVien(Me.dtgcapnhatthongtin.CurrentRow.Cells(1).Value, message)
That is a function for deleting info. Now I want to create other function and get above function to parameter. I mean:
Public Function func(Byval func as " What type can be ?")

View 13 Replies

Oop - Put A Default Value To A Parameter Of A Function?

Dec 9, 2010

its just like that in other langauges (php in the example)

function myFunction($message,$sender="nodoby") {
return $message." by ".$sender;
}

View 2 Replies

Is There Function Takes Name Of Instance And Return Instance

Feb 29, 2012

I was trying to fill 10 checkedlistboxes with items..So I made a sub with 2 arguments like this Private Sub fill_checkedlistboxes(ByVal items As String, ByVal checkedlistbox As CheckedListBox) End sub the first argument items is a long string whitch splits in the sub into many strings and added them all into the second arguments (thecheckedlistbox) I want to make for next statement to fill all the 10 checkedlistboxes in my form with an 10 long strings held in an array called strings, so i write something like this [code] What i have to write in the "?????" area to have the checkedlistbox that i want? the checkedlistboxes names are checkedlistbox 1, 2 , 3 ....10

View 12 Replies

Calling Functions - Call The Function In Order To Populate The Second List Box Upon Selection Of The First

Mar 22, 2011

I have a midterm project where we must replicate what our teacher has made, it is a convenience store program. I am having trouble calling the functions, he wants us to use these:

PopulateItems => Populate Items listbox based on the category selected
GetItemPrice => Retrieve the price for a given item
GetItemPriceFromPurchases => Retrieve the item price from the purchases list box (optional. You may not need

[CODE]...

So far I have the first list box populated when the form loads. However outside of that I do not know where to call the function in order to populate the second list box upon selection of the first.

View 3 Replies







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