Pass An Object As A Parameter To A Fortran Method?

Aug 25, 2010

I'm currently working on being able to import a DLL written in Fortran into Visual Basic. I've got all the basics down, so now I'm trying to take it a step further. The title basically says it all, but I'll explain what it is I'm trying to do anyways.

For kicks and giggles, let's just assume I want to pass an object that has three double values in it, possibly representing a point in space in three dimensions. In my Fortran method, I want to take that object, print out the x value, then change the x value to 7.5. Here's my Fortran code that does just that.[code]...

View 2 Replies


ADVERTISEMENT

Pass A Method Like A Parameter Of Another Method

Feb 4, 2011

Is there a way to choose between different methods and pass one into another method ?

Sub conditionnal_binding(ByVal list_box_reference As ListBox, ByVal list_box_final As ListBox, _
ByVal dico_source As Dictionary(Of String, List(Of String)), _
ByVal my_methode As ??? )
' DO SOMETHING
End Sub

I wrote ??? because I don't know how to call another method inside a method.
I would like to choose between different "sub-methods". Here is how I would like to use my method :

conditionnal_binding(ListBox1, ListBox3, HTML.dico_basic_attribut, best_method)
conditionnal_binding(ListBox1, ListBox3, HTML.dico_basic_attribut, some_method)
conditionnal_binding(ListBox1, ListBox3, HTML.dico_basic_attribut, another_method)

View 5 Replies

Pass Null Parameter Fill Method Of Tableadapter?

Jan 17, 2012

I have already defined in my SELECT statement in TableAdapter to tell it what to do if the parameters are Null:

SELECT a.ID, a.NameID, b.BNameID
FROM a INNER JOIN b
ON a.ID = b.ID
WHERE ((@NameID IS NULL) OR (a.NameID = @NameID))
AND ((@BNameID IS NULL) OR (b.BNameID = @BNameID))

View 4 Replies

C# - Pass An Integer As A String Parameter To A Method Without Calling .ToString()?

Mar 12, 2010

In VB.NET, it is entirely possible to pass an integer as a string parameter to a method without calling .ToString() - it's even possible to call .ToString without the ()'s. The code will run without a problem, VB will interpret the integer as a string without having been told to. In C#, these would cause compilation errors - you are required to call .ToString() and to call it correctly in that situation before it will compile. Is there a way to make the VB compilation process check for the same things as the C# compilation process? Would it be best practice in a mixed team to force this check?

View 3 Replies

Object Must Pass Itself As A Parameter?

Sep 10, 2011

I have various shape objects, and I want each unique shape to implement a saveToDB method that simply calls a DB object that implements a Save method with an object as its input paramter. This DB.Save method will be a long case function that implements the proper SQL commands based on the type of attributes possessed by the input parameter object.how do I implement the SaveToDB method in my Shape class? Is it something like this:

Function Shape.SaveToDB
DB.Save(Me)
End Function

The goal here is to let each shape save itself without it knowing anything about database operations; I want to isolate db-specific information in my intermediary DB object, so the DB object will have to figure out what type of object wants to be saved into the SQL database and then execute whatever SQL instructions are needed. And then if I override the SaveToDB method in each shape subclass, I can avoid the case statement entirely, replacing it with a series of unique methods such as db.SaveCircle (ob), db.SaveSquare (ob), etc., sincle the caller already knows what it is.

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

Populate A List(Of Object) In A Class Method, Where The List Was Passed To The Method As A Parameter

Aug 13, 2011

I'm trying to code a class of RandomNumber. One of the class methods needs to populate a "List (Of RandomNumber)" ... which was passed as a parameter to the method ... with 10 random numbers between 1 and 50. DEAD SIMPLE :)

View 6 Replies

Call A Method And Pass In An Object?

Apr 21, 2012

I have a method called ADD in a class that connects to a database. The database class name is XDB. I also have an object named XXX in it's own separate class with properties.One of the instructions for the Button named ADD click event is:

'Call Add method passing in the XXX object

So this is how I coded:

'declare a variable X as an object instance of XXX
Dim X As New XXX[code].....

I know it's wrong since it doesn't add the XXX and the form doesn't close but I don't know what I'm doing wrong.

View 6 Replies

Pass A String From VB 2010 To A Fortran DLL?

Aug 3, 2011

I can pass integers, singles, doubles, and arrays of all these back and forth with no problem. But I can't figure out how to pass a string in Visual Basic 2010 to a character variable in the Fortran DLL. I keep getting the PInvokeStackImbalance error. I could just convert the Visual Basic string to an integer array containing the ASCII code for each character, send that, and convert back inside the DLL, but that's pathetic. There must be a simple way to do this.

I first tried using Dim txt(50) as Char in VB2010, and character*50 txt in the DVF F90 DLL but that didn't work.

Then I tried Dim txt as String in Visual Basic 2010 and made the string 50 characters long (also tried 49) but this didn't work.

View 2 Replies

Use IList(Of IList(Of String) - Pass It As A Parameter To Another Method?

Aug 2, 2011

I'm trying to use a variable that is simply a list of a list of strings.I've declared it as follows:

Dim iRows As New List(Of List(Of String))

Then I'm trying to pass it as a parameter to another method and I've defined the method as follows:

Public Sub Import(ByVal Rows As IList(Of IList(Of String)))
For Each Row As IList(Of String) In Rows
ImportRow(Row)[code]....

Unfortunately, when I try to run that code I get the following error where it tries to pass my variable to my method.

System.InvalidCastException was unhandled by user code
Message="Unable to cast object of type 'System.Collections.Generic.List1[System.Collections.Generic.List1[System.String]]' to type 'System.Collections.Generic.IList1[System.Collections.Generic.IList1[System.String]]'."

When I change the method definition to use the types rather than the interfaces as follows, it works.

Public Sub Import(ByVal Rows As List(Of List(Of String)))
For Each Row As IList(Of String) In Rows
ImportRow(Row)[code]....

So, is it not possible to use generics with interfaces in this way? It works fine as long as I'm not nesting them.

View 3 Replies

Write Fortran Or To Integrate Fortran To VB 2010?

Nov 7, 2011

I was wondering if there was a way to write fortran or to integrate fortran to Visual Basic .net 2010..Maybe with adding a refferance or something? what options are available?

View 5 Replies

AddressOf With Parameter - Method Which Requires A Parameter To Be Passed In

Mar 1, 2009

I have a method which requires a parameter to be passed in. I would like to use the Addhandler to call the method through a dynamically created button control's click event.

When I include () in the AddressOf, VS complains: 'AddressOf' operand must be the name of a method (without parentheses).

When I exclude the brackets, VS complains: Method '...' does not have a signature compatible with delegate...

My code:

CODE:

View 5 Replies

Javascript - Pass Page Or Master Page Object To AJAX Page Method

Oct 5, 2010

I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.

see my code

<script type = "text/javascript">
function ShowCurrentDateTime() {
$.ajax({

[Code]....

How to pass Master Page object or Page to Page method?. So I can use in Sared method.

Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.

View 3 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

How To Pass Parameter To EXE File

Oct 7, 2010

I am currently still learning to use VB.Net feature. Currently I am trying to execute a .exe file where there will be passing parameters to run the script. E.g. this how it works on the command prompt line:
C:Documents and Settingsproject1>textfile.exe file1.txt file2.txt file3.txt file4.txt
Above line will be able to run the textfile.exe script.

I am using VB .Net to create a User Interface where user will be able to use the 'OPEN CLICK' button to choose the files (which will display on a textbox) and click on a 'START' button to run the program. I managed to find a code - process.start() feature, however it cant seem to work..

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim MyProg As String
Dim executable As String
executable = "C:Documents and Settingsproject1 extfile.exe"
MyProg = TextBox1.Text
Process.Start(x, MyProg)

View 4 Replies

Pass A DataRow As A Parameter To A Sub?

Apr 22, 2010

Is it possible to pass a DataRow as a parameter to a sub?The following example will (hopefully) make clear what I want to do.

Code:
myDataAdapter.Fill(myDataSet)
For Each myDataRow In myDataSet.Tables.Item(0).Rows
MySub(myDataRow)
Next

And the sub:

Code:
Private Sub MySub(ByVal drData As DataRow)
End Sub

I get an error at design time: Error 2 Expression does not produce a value.

View 3 Replies

Pass A Field As A Parameter

Jan 27, 2010

I have the following function:[code]I need to know if it's possible for a function to take a parameter as a type of field?

View 3 Replies

Pass A Parameter To A Query?

Feb 26, 2009

I am trying to load a combo box based on a selection of data from another combo box. I am not sure how I would pass the value to the object. My thought is I am loading all the table data onto my object and then I would run the query on the object. However I am at loss as to how I would go about doing that.

Private Sub cboOrder_SelectedIndexChanged(ByVal sender As System.Object, ByVal e AsSystem.EventArgs) Handles cboOrder.SelectedIndexChanged
Dim selecteditem As String

[Code]....

View 4 Replies

Pass An ID Parameter Using A Button?

Feb 10, 2009

how to use a button to pass a SQL parameter "ContactID" to the next page to allow the SQL to execute the Select Query. From what I've found here is what the code behind for the button looks like.

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ContactID As String
ContactID = Request.QueryString("id")

[code]....

Here is the error I'm getting back. What have I done wrong?Compiler Error Message: BC30506: Handles clause requires a WithEvents variable defined in the containing type or one of its base types.

View 2 Replies

Pass Event As A Parameter?

Nov 9, 2010

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. [code]...

View 3 Replies

Sql - Pass Parameter As Date In .net Web?

Apr 18, 2010

I have a mail webform where I have to show the user only (-1) one day behind messages, so how do pass (yesterday)date as parameter and retrieve the only records of one day back ?This query is for 'ALL' messages, but I need to filter (yesterday) one day back messages and add a hyperlink or add in a dropdown ?

select MSG_SRNO,MSG_SUBJECT,MSG_ID,MSG_CHKD,
DOF_SENT,DOF_SEEN from MESSAGES_MAILBOX where USER=1234

View 2 Replies

Function - Pass Object Versus Reference Object In Parent?

Dec 1, 2011

I am working on a application that has quite a few functions involved and have been thinking of the following: If I have a function that has a few paramaters, is it more efficient to pass the objects to the function(Example 1) or reference the objects in the parent(Example 2)? Does it matter if the objects are large or not?

Example:

Class mainform
Public myGenericList As New List(Of String)
Public myDatarowArray() As DataRow

[Code].....

View 6 Replies

Asp.net - Pass Two Parameter To Event Handler

Jun 13, 2011

i struggling to pass two parameter to an event handler basically when the page is load it dynamically create some control lable, textfield, and linkbutton when i click on the link button it fire an event handler, here is my problem i want to pass first the Product ID and quantity, the product id is fetch from the database passit thorugh an object where as the quantity it enter by the user first part of the code it connect to database loop through and display all record on the page dynamcally

[Code]....

View 2 Replies

Asp.net - Pass URL Parameter To Repopulate Page?

Apr 11, 2012

I currently have a page that is populated using a filter, which passes the parameters of the filter via URL.

I'd like to catch those parameters and give the user the opportunity to return to the page with the same filter applied to their view. Essentially, it's a back button. AKA: pass the parameters back into the URL so it repopulates the page.

View 1 Replies

How To Pass Integer As Unsigned Parameter In .Net

Jul 16, 2010

I'm new to VB.Net. I'm using a library call setInstance(ByVal instance As UInteger) in my VB.Net code. The parameter I need to pass is an Integer. Is there anything I need to do to convert the integer parameter to an unsigned integer? The number is garunteed to be positive and less than 10.

View 3 Replies

Pass A Form As A Parameter In A Function/Sub?

Mar 23, 2010

Can I pass a form as a parameter in a sub like public Sub GetData(Byval Frm as form) and access its controls?I have few forms (you can say: FrmAccounting, FrmEngineering, FrmIT) with almost the same controls in each of them (txtEmployeeID, txtEmployeeName, optMale, optFemale etc), where no two forms are open at same time, and each of those forms have a Button which opens a new Form (you can say FrmCollectData) now I want to fetch data in FrmCollectData depending on which form it was opened from.. like if user was on FrmEngineering and it clicks button to open FrmCollectData.. form collectData fetches data from FrmEngineering Controls and if user was on FrmAccounting and it opens FrmCollectData, form Collectdata fetches data from FrmAccounting..

earlier, in VB6.. In one of the Sub written in frmCollectData I checked which form is opened by setting flags in each of forms (frmEngineering, frmAccounting etc) and then I passed the same form in a sub which writes data in frmCollectData controls.. but am not able to do the same in VB.NET.

View 5 Replies

Pass A Parameter Vs Using Shared Member?

Jun 30, 2011

Just asking for personal preferences, pros,cons on the following situation. I have a class(classA) that has some shared members in it. I have a procedure in a form that needs to execute a function in a separate class(classB). This function requires some of the shared member values from classA. I can either pass these values as parameters from the form to classB, or in classB I can just access them directly by referencing classA. As a general rule I've tended to try to use parameters to pass all the information a function needs but it starts to seem a little unwieldly when passing several parameters to multiple procedures.

View 9 Replies

Pass Array To Function As Parameter?

Dec 7, 2010

I would like to pass array to function as parameter. Here is an example for variable that is not array:

[Code]...

View 5 Replies

Pass Control As A Parameter To A Function?

May 27, 2009

i am designing an application in which contents of an excel file are displayed in the ListBox. i have created a class which contains methods for doing this. Statement used for function call is:

oSheet = obj.displayColumns(oWB,
Me.lbColumnNames)

[Code].....

line where i am getting error is underlined. Is it possible to send controls as a parameter ?

View 5 Replies

Pass Crystal Report Name As Parameter?

Dec 3, 2010

I am using a function which is calling a crystal report as [code]...

View 1 Replies







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