VS 02/03 Passing Array As A Parameter?

Nov 16, 2010

I'm wondering if this sort of thing is possible in VB.NET.. say I have a routine which accepts an integer array, defined as:

Sub WriteTable(iRows As Integer, arrColumns As Integer())
The arrColumns parameter is an integer array of column widths.
I can pass a value by doing this:

[code]....

View 11 Replies


ADVERTISEMENT

VS 2005 Passing An Array As A Parameter In A Sub?

Sep 14, 2009

I am working with some code that uses array lists and I am using some of these to pass data back and forth like this: whatFile = (sideLookUp(x)) and its working, BUT when I turn this code into a sub/function then I call it I get problems, like double to string errors, even though its all set to double.

[Code]...

View 8 Replies

Original Value Changed While Passing Array Parameter Using ByVal?

May 31, 2009

have a subroutine which parameter is an array like below:

Private Sub DoubleArrayValues(ByVal arr() As Integer)
Double the values.

[code].....

View 7 Replies

2008 Passing In SQL Parameter Where Datatype Is Date Array (SQL Server 2005)?

Jan 28, 2010

I'm attempting to pass in a collection of dates to a T-SQL 'IN' clause via a date array (see below for how data is collated).

'Workout weeks difference between start and enddate
Dim wksDifference As Integer = CType(DateDiff(DateInterval.WeekOfYear, bookingStartDate, bookingEndDate), Integer)

[code].....

View 9 Replies

Passing A Parameter Containing '&'

Feb 16, 2012

I am calling a crystal xi report from a windows form and passing 2 date parameters and a customer name. In some cases this customer name contains '&' eg Brown & Williams

In these cases my report fails and errors. if the name doesn't contain '&' it works. How can I pass the parameter with a & in it ?

View 2 Replies

Passing A Parameter To A Dataset

Apr 26, 2011

I created a dataset that is getting data from an access database. Now i would like to go further and make the dataset query accept a parameter from a form datepick value. the query in my table adapter I have changed it as follows to accept a parameter on date1.[code]The code I am using in my form is as below. I get a null reference exception on the second line(Object reference not set to an instance of an object). it seems as if my selectCommand is bringing nothing.[code]

View 4 Replies

Passing A Parameter Value To DataSet.XSD?

Jun 2, 2012

I have a bound DataGridView (dgvBuild) that contains data based on a "ProductID" that is derived from selecting the value from a ComboBox. How do I pass the ComboBox Value to the DataAdapter to retrieve records to reload the dgvBuild? Below is the code for theDataAdapter.This is the line that was created when I bound the DataGridView to a DB Table.

View 8 Replies

Passing An Event As A Parameter

Jun 10, 2011

I need to pass an event as a parameter to a function and I'm wondering if there is any way of doing this.The reason why I need to do this is because I have a sequence of two lines of code that is littered all over my program, where I dynamically remove the handler to an event, then set the handler again. I'm doing this for several different events and event handlers, so I've decided to write a function that does this. As an example, let's say I have a combobox in my code called combobox1, and I have the handler called indexChangedHandler. In several places of my code, I have the following two lines:[code]Now, I don't want to keep on repeating the above two lines of code (or similar) all over my program, so I'm looking for a way to do this:[code]So far, the "evt as Event" part of the argument of the setHandler function is giving an error. Any ideas on the right way to do this will be very welcomed.

View 2 Replies

Passing An Event As A Parameter?

Nov 10, 2010

I need to pass an event as a parameter to a function and I'm wondering if there is any way of doing this.

The reason why I need to do this is because I have a sequence of two lines of code that is littered all over my program, where I dynamically remove the handler to an event, then set the handler again. I'm doing this for several different events and event handlers, so I've decided to write a function that does this.

As an example, let's say I have a combobox in my code called combobox1, and I have the handler called indexChangedHandler. In several places of my code, I have the following two lines:

RemoveHandler combobox1.SelectedIndexChanged, AddressOf indexChangedHandler
AddHandler combobox1.SelectedIndexChanged, AddressOf indexChangedHandler

Now, I don't want to keep on repeating the above two lines of code (or similar) all over my program, so I'm looking for a way to do this:

Private Sub setHandler(evt As Event, hndler As eventhandler)
RemoveHandler evt, hndler
AddHandler evt, hndler
End Sub

so that everywhere where those two lines of code(or similar) occur in my program, I can just replace them with:

setHandler(combobox1.SelectedIndexChanged, AddressOf indexChangedHandler)

So far, the "evt as Event" part of the argument of the setHandler function is giving an error.

P.S I've asked this question on a couple of other forums and keep getting asked why I would want to set the handler immediately after removing it. The reason is because dynamically adding an event handler n-times causes the handler to be executed n-times when the event occurs. To avoid this, i.e to ensure that the handler is executed just once when the event occurs, I first remove the handler each time I want to add the handler dynamically.

You might be asking why the handler would be added several times in the first place... The reason is because I add the handler only after a particular event, say E1, in my form has occured (I add the handler within the handler of event E1). And event E1 can occur several times within my form. If I do not remove the handler each time before adding it again, the handler gets added and thus executed several times.

Whatever the case, the processing occuring within the function is not of ultimate importance to me at this time, but rather just the means of passing an event as a parameter.

View 3 Replies

Passing Delegate As Parameter

Nov 6, 2010

I'd like to create a function myFunc with one parameter, which is a delegate. I should be able to call it with a delegate as parameter.E.g.[code]But how do I code myFunc, in other words, how do I enable myFunc to have it passed a delegate so that it can be called using myFunc(addressof test Func)?

View 4 Replies

.Net With Passing Parameter To Crystal Report?

Dec 12, 2009

sample code for passing parameter to crysatl report dynamically in vb.net ...?

View 2 Replies

Call VBA Function With Parameter Passing

Dec 29, 2008

I wrote vba function in excel and I want to call this function in vb.net with parameter passing.

View 2 Replies

Error On Passing Date Parameter

Jul 24, 2010

I am getting error when debugging a project. The error is as below,

"FormatException was unhandled

String was not recognized as a valid DateTime."

Highlighting the following line

[code]...

View 1 Replies

Passing AddressOf As A Parameter To A Subroutine?

Jun 30, 2011

Assuming I have the following code that is iterating over controls in a panel setting various control information.Private Sub BindDataFields()

[Code]...

View 7 Replies

Passing An Optional Parameter To A Webservice

Nov 1, 2010

Is there a way to pass an optional parameter to a webservice, instead of having to overload the method?If the webservice user is accessing the webservice directly, I want to do ActionA, if the user is accessing the webservice through my web interface, I want to do ActionA + ActionB.

View 1 Replies

Passing Parameter From To Stored Procedure?

Aug 12, 2010

Can't seem to figure out why this is not working.

Dim Myspcmd As New SqlCommand("spDataImport", myConnection)
Myspcmd.CommandType = CommandType.StoredProcedure
Myspcmd.Parameters.Add(New SqlParameter("@FileName", Data.SqlDbType.NVarChar, 100)).Direction = ParameterDirection.Input
Myspcmd.Parameters("@FileName").Value = "Import_File.dtsx"
myConnection.Open()

[Code]...

View 11 Replies

Passing String Parameter To C++ Unmanaged DLL?

Nov 2, 2011

I'm calling unmanaged C++ Dll function from VB.Net project by usin dllimport attribute like this;

<DllImport("Injection.dll", CallingConvention:=CallingConvention.Cdecl)> _
Private Shared Sub Injector(ByRef Client As String, ByRef Dll As String)
End Sub

View 4 Replies

Passing Value To SQL Query Parameter From Textbox

Sep 9, 2011

I am using following code to connect to my database.
Dim conStr As String = "Data Source=.SQLEXPRESS; ![enter image description here][1]
AttachDbFilename=|DataDirectory|dbTest.mdf;
Integrated Security=True;
User Instance=True"
Dim sqlQry As String = "SELECT * FROM [tblTest] WHERE ([Name] = @Name)"
Dim dAdt As New SqlDataAdapter(sqlQry, conStr)
Dim dSet As New DataSet()

Then filling adapter with
dAdt.Fill(dSet, "tblTest")
And then I can use the data the way I want.

My question is: How to pass the value of parameter that user will give through a text box on my webform.
Dim sqlQry As String = "SELECT * FROM [tblTest] <b>WHERE ([Name] = @Name)
I mean how to pass the parameter value to my query?

View 2 Replies

Simple Parameter Passing To Oracle DB?

May 1, 2012

Im using a datatable and i am trying to do a insert statement into an oracle database by passing selected values from the datatable to the insert statement via parameters. I'v traced the parameter collection and it has the correct number of parameters to be passed but it is giving me an error saying a value being passed in is null but it is not, during debug you can clearly see the value of the parameter is not null.

Dim FuelInsert As String = "INSERT INTO table (COMPANY, TRAN_DATE, GAS_GALLONS,DSL_GALLONS,DEF_GALLONS,KER_GALLONS,E85_GALLONS,DDS_GALLONS,WDS_GALLONS)" _
+ "VALUES(:Company, :Trans_Date, :Gas_Gallons, sl_Gallons, ef_Gallons, :Ker_Gallons, :E85_Gallons, ds_Gallons, :Wds_Gallons)"

[code]....

I just wanted to know if there was a easier way of creating the parameters or if i am missing something simple that causing the values of the parameters being passed to get mixed up. The code retrieves the values i need and builds the parameter collection of 0-8 nodes which is correct.

View 1 Replies

Sql - Passing Date As Parameter For Query?

Jun 18, 2011

I want to pass a date as parameter in vb to query the data from the table.If I hardcore the value in the query it works fine for me, but if I pass it as parameter to query, like I am getting the data from edit text and trying to send that as a parameter, this does not work.

SELECT *
FROM VehicleAnalogParamDownload2
WHERE Vapd2_Date between 'From_date.Text' And 'To_Date.Text'

View 2 Replies

VS 02/03 Crystal Reports Parameter Passing?

Aug 12, 2011

I seem to be passing the parameter to the report (I placed the parameter field itself on the report to verify this) but it does grab any information based on this parameter. All of the fields appear with no data but the parameter is showing up correctly.Yes, I have verified that the parameter is in the select statement of the report.The report also is exporting correctly but still without the data.

Below is the code I'm using:

CR Loading
Try
Dim cryRpt As New ReportDocument()
Dim reportPath As String = "MyReport.rpt"
cryRpt.Load(reportPath)

[code]....

View 1 Replies

VS 2005 Passing A Parameter With AddHandler?

Oct 2, 2009

From what I understand, when you use AddHandler you're not actually calling a Sub, so you can't pass a parameter. I'm confused on what to do though about this. I've just populated a DataGridView and added a button to it in the codebehind. I'm then using an AddHandler to add a click event to the button. So when I get to the click event, I need to be able to access to the datagridview because clicking the button takes data from the datagridview and loads it into excel. What would I do about this. This is my Method where DataGridView was just populated

Dim btn As New Button
btn.Name = dgv.ToString()
btn.Location = New Point(0, 0)

[code]....

View 1 Replies

VS 2008 Passing Parameter To A JAR File?

Aug 29, 2011

In my VB.NET project I wanted to run a JAR file in a separate thread. Now the question : Is it possible to pass parameters to a JAR file during run time from VB.NET??

View 1 Replies

.net - Passing A Method (that Returns A Value) As A Parameter A Bad Thing?

May 21, 2012

So for instance I have this method: LoadFunkyInfo(byval funkyData as string) And I pass it something like this:

LoadFunkyInfo(giantTable.Rows.Item(0).Item("blahName")). Should I do this instead?

dim foo as string = giantTable.Rows.Item(0).Item("blahName")
LoadFunkyInfo(foo)

I read somewhere long ago, that it's better to assign the method to a variable and pass that variable to a method, as opposed to passing the method as a parameter. Is that still true? Or true at all?

View 5 Replies

.net - Passing Parameter To Query For Access Database?

Sep 19, 2011

I am using following code and trying to get data by given parameters. I donot know how to pass the parameter value to my query.

[Code]...

View 3 Replies

Passing A Combobox Reference As A Function Parameter?

Sep 23, 2008

The case is that I have two comboboxes (country and state) and a simple code to populate the state combobox accordingly depending on the selected country. Ok this is simple and easy, and this code is within the country combo change event.The case is that I have more than one pairs of those comboboxes and I wouldnt like to repeat all the populate code into every country combo change event.Actually I would like to have only one function and just call it passing as parameter a reference to the combobox I want to populate. Then I could use that reference into the function.

View 10 Replies

Passing A Table Valued Parameter With No Rows

Apr 15, 2012

I am trying to execute a stored procedure which has table valued parameters along with other parameters. The only parameters I need to pass values for are latitude/longitude range and dates. For the others, I need to pass null. After a lot of searching and a lot of trial and error, I came up with the following:

Dim empty
As
IEnumerable =
Enumerable.Empty(Of
SqlDataRecord)()

I then pass empty for the table valued parameters. This works for the first two tvp's, but on the third one, I get this error:

There are no records in the SqlDataRecord enumeration. Tho send a table-valued parameter with no rows, use a null referece for the value instead.

how to make this work? I do not have control over the database or the stored procedure, so I can't change that. The code that calls the stored procedure is:

GetHistoryByMultipleCriteriaTableAdapter1.Fill(AISTable, empty, empty, empty, vbNullString, vbNullString, -60, -25, -35, 10, "4/1/2012 12:00 AM", "4/4/2012 12:00 AM", vbNullString)

I am not a developer, but an engineer who does development occasionally, so I may need more explanation than the average developer.

View 2 Replies

Passing Control As Parameter To JavaScript Function

Sep 27, 2011

I am trying to pass a control's id to a javascript function that adds the value of it (the control which is a textbox) to a listbox but apparently I am not getting it right.

<input type="button" ID="btnAddtoLstBox" value="" title="Add this to the list" onclick="javascript:addToList(document.getElementById(btnAddtoLstBox));"
class="ui-icon ui-icon-refresh ui-corner-all" style="width: 20px; height: 20px; background-position: -64px 80px" />
[Code] .....

View 2 Replies

Passing Null To An Optional Parameter With Default Value?

Sep 22, 2010

I think this is a pretty basic question, but I just want to clarify. If I have a variable with a null value, and pass it as a parameter that is optional, will the parameter get the null value, or the default value?

dim str As String = "foo"
dim obj As Object
//call 1

[code].....

View 1 Replies

Passing Parameter (Value Or Referenced Type) Into Method?

Nov 11, 2009

What happened when parameter passing. Here is a test project I write.
Public Class Form1
'1.test string
Private Sub btnString_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnString.Click
Dim str1 As String = "x"
[Code] .....

From the project you can see, when pass integer type parameter (value type) into a method , if use ByVal keyword, the value won't change. If use ByRef keyword, the value will change (I can understand it, to my understanding, when using ByVal, It pass the value of the argument to the method; when using BvRef, it pass the address of the argument to the method, so the value can be rewrite)

Well, for the following two scenarios , I can't understand why.
String type is reference type, but it acts like integer type.
Val type is also reference type, but no matter what you use(ByVal or ByRef), the result will be the same.
So my question is what actually passed into method? What's the underlying mechanism about pass parameter? What's the effect of ByRef and ByVal to value type and reference type?

View 1 Replies







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