How To Pass Object As Sub

Jan 20, 2012

This code copose from Class including tow sub first sub to insert data in DB Ms access- second code: to check if there is same number of Tel if there is not same number will excute the first code insert, if there is same number of Tel it will show messagebox the problem that I faced is by how to pass object(InsertData) from CheckN sub. It showed me error : Expression is not a method

[Code3]...

View 1 Replies


ADVERTISEMENT

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

How To Get Name Of Object And Pass Parameters

Jan 31, 2012

For example if I have a function call like below
Function callingMe()
Exit Function

And my Function call is like below
SomeObj.callingMe('1','2','3','4','5') // Variable number of arguments
Inside callingMe() function, I want to know arguments passed i.e 1,2,3,4,5 and the Object i.e SomeObj in above case.

View 2 Replies

Make An Object Not Pass Through Another?

Apr 5, 2012

I am making a simple maze game that you use the arrows keys to navigate. I completed the movement part of it, but now i'm having trouble with the walls. How can you make an object not pass through another and how to tell the program what to do when a object gets to a defined place(the finish)

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

Pass A Function As An Object Instead Of It?

Dec 20, 2011

I'm trying to give a default value to the register property method. This required a function, but passed as an object(delegate?).[code]....

I want to call that registerproperty method, but I don't know how I can do that in VB.net. I just need to pass along a new Person object and I thought this was the way to go[code]....

View 3 Replies

Pass Data Out Of An Object?

Dec 17, 2010

I have this [code]...

1. Create a global SQL instance and call .Write from within .ReadData

2. Create a new SQL instance within .ReadData and call .Write

3. Pass the data back to the code above and call .Write from the main code i.e. [code]...

View 1 Replies

Pass Object Between Asp.net Applications?

Jan 6, 2012

We have a few applications that will be passing a token object around and I wanted to get an idea about the best approach at doing this.

For starters, this token object is somewhat simple. It would have about 5 properties or so.

Would we create a WCF app and reference it through a datacontract?What about serializing it and sending it through an http post? (each app have a referenced dll of the object)Querystring? (I truly don't think this would be good, but put it up nonetheless)?

View 2 Replies

Pass Out An Object Array In .NET?

Mar 25, 2011

I'm writing a wrapper class to expose a subset of the functionality of a .NET FTP library edtftpne from Enterprise Distributed Technologies.

When you call the edtftp's GetFileInfos method you get an array of FTPFile objects returned. I'm able to iterate through these but I don't know how to pass them on as a new and different object array containing only Name and Size for each file. Here's the code I have. Sorry it's a little confusing because I have my own class named FTPFile and the .NET library I'm using also has a class named FTPFile. I'm using both of them here. I should probably change the name of my class just to avoid confusion:

Public Function GetFileList() As FTPFile() Implements IFTP.GetFileList
Dim ftpfiles() As EnterpriseDT.Net.Ftp.FTPFile
ftpfiles = fCon.GetFileInfos 'Fill object array

[Code]....

I'd just pass on the object array that I'm getting from the GetFileInfos method but COM clients won't have access to the class/object EnterpriseDT.Net.Ftp.FTPFile without me rewriting it, I'm assuming.

View 1 Replies

Asp.net - Pass An Object Into A UserControl In A Repeater?

Jul 24, 2009

I want to wrap up a chunk of HTML render logic in a User Control. Then I want to pass a custom product object (title, thumbnail, id, etc.) to the UserControl that it can use when it renders. Ideally I want to use this in a repeater (or for loop) and pass the current custom product object into the UC.Every example I've seen has been passing through strings on the UC tag but thats not really want I want to do as it means I'll have references everywhere that need updating should we add a new field that needs rendering.

.Net 1 using VB.net (not my first choice for .net so go easy)HTML example to get us going, this would be in the .ascx page:

<div>
<h3><%= myProd.title %></h3>
<img src="<%= myProd.thumbnail %>" />
<p>

[code]....

Yet in my ascs page I get:"Object reference not set to an instance of an object"

Line 1: <%@ Control Language="vb" AutoEventWireup="false" Codebehind="ProductRender.ascx.vb" Inherits="MyApp.ProductRender" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
Line 2: <h3>
Line 3: <%= myProd.title %>
Line 4: </h3>

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

Calling A Sub And Pass In Parent Object?

Jul 6, 2009

I have a statement that will call a Sub.

Charts(CurChartNo) = Server.CreateObject("ChartFX.WebServer")
Call InitChart()

Inside this sub, I will assign values to the properties of the Charts object that is

Public Sub InitChart()
Charts(CurChartNo).RGB2Dbk = &HC0FFFF&
Charts(CurChartNo).Chart3D = False

[code]....

But the Charts is not recognized in the Sub. This is current program under ASP, I am converting to ASP.Net.

View 3 Replies

Correct Way To Pass The Graphics Object?

Oct 2, 2009

When I do my form_paint event, I have quite a lot to redraw, so I'm breaking into into severals subs to make it easier to read. I'm passing the 'e' variable into my subs as shown below, is this correct?

Private Sub frmMain_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
DrawMap(e)
End Sub
Private Sub DrawMap(ByVal e As System.Windows.Forms.PaintEventArgs)
End Sub

Am I right in copying that whole 'e as system.windows....' etc line from the form_paint details into my subs details?Just to clarify, the sub will draw directly onto the form.

View 3 Replies

Dynamically Pass Values To An Object?

Mar 28, 2011

How can I do this:

Dim oMyObject As New MyObject
oMyObject.DoSomething("Parameter1","Parameter2")

The "DoSomething" and the two parameters are dynamically provided from another script. They are stored in a string object in this script: sAction & sParameters. My question is how can I dynamically pass the "sAction" to the object oMyObject.For example oMyObject.sAction (where sAction should be the value stored in the sAction string). The example will probably not work. Is there a way to do this? The idea behind is to avoid having to write each function hardcoded, like:

If sAction = "DoSomething" then
oMyObject.DoSomething(sParameters)
ElseIf sAction = "AnotherThing" then

[code]....

View 5 Replies

Pass A String Return An Object?

Feb 12, 2011

I 'm new to programming and to vb. So my question could be from misconception about what can i do. How can i pass a string to a "procedure" and get in return a object whith the same name as the string?

View 8 Replies

Pass An Object Type To A Class?

Jun 18, 2009

I create a object type entity in the main function and would like to pass it to a separate class, do some calculation, and then pass the result back to the main function. But I keep getting errors, can someone point me where I did wrong? It's in windows application[code]...

View 2 Replies

Pass Object To Function Using CodeDom?

Jun 27, 2010

How do you pass a control (say a textbox) to a function as a parameter in compiled assembly using CodeDom? I've tried passing through the args in the Invoke method but it doesn't work.[code]...

View 6 Replies

Pass Reference Object From One Form To Another?

Apr 29, 2011

I have maintain a common data table for 3 forms.[code]...

View 5 Replies

Pass Variables To A COM Object From Application?

Aug 10, 2010

I am writting a VB .net (3.5) applivcation which references a COM object. I can call methods on the COM object fine provided that they don't require any variables to be passed. I have been told that you can only pass a maximum of one varaible to a COM object, I really don't believe that it true

for example
objsession.connect()
works fine
but

[Code]...

View 6 Replies

VS 2005 Pass My.Settings Object To A Sub?

Dec 17, 2009

I have a sub that I want to receive a My.Settings object. I don't know, though, which kind of object to use in the declare line of the sub. For example:[code]

View 3 Replies

Pass An Argument To Dispatcher Object In Program?

Aug 22, 2010

In a threaded app in VB 2010, I can do this[code]...

View 6 Replies

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

Pass The Property Of An Object To A Function ByRef

Jul 16, 2009

If you pass the property of an object to a function ByRef, and the function doesn't modify the ByRef parameter, the property Set is still called.

[Code]...

View 11 Replies

Threading - Baton Object That Routines Can Pass Around?

Feb 20, 2011

This will no doubt sound like a pretty dumb question to some, but, despite having written many useful single-thread apps over the years, I don't understand enough about threading yet.

Consider this scenario:

There are four modules, each on its own thread, that can happily run concurrently most of the time. However, each module occasionally causes a few seconds' intensive disk activity (by design) and it would be more efficient (faster, less fragmentation) if only one module at a time wrote to the same physical drive.

It would be useful to have something like a baton that modules within a given scope can pass around, perhaps dependent on their respective priority levels.

View 2 Replies

How To Pass Form Object To Data Class For Update

Mar 11, 2009

I am converting some VB6 code which passed an unknown form object to a class, which then used the passed form object to reference the calling form and direct the data from the class as follows:
The Called Class in the class clsGetRecord
Public Function Execute(ByRef FRMForm as form) as booleanFRMForm.List1.Additem(SomeData)....Execute = SomeBool End Function
The clsGetRecord is used by many different forms which receive data all have objects called List1 as: The Calling Form for the form
frmThisFormPrivate function() as booleanDim objRecord as new clsGetRecordbRet = objRecord.Execute(frmThisForm)
The passed form object which will receive dataEnd function. Is there any simple way to do this since the calling form object is unknown at design time?

View 2 Replies

[2005] Pass Excel.Application Object To Shared-Addin By .Net?

Jan 22, 2009

I currently need to build a Automation Add-in for Excel. This add-in will load a recordset from Database to Excel. I would like to have function A() that I input in Cell as a formular. This function A() call a the add-in to load the data from Database to Excel. The data should be a matrix. So that means I would like to set in Excel worksheet a range of data by just calling single function in a cell. (I am sure there should be some way to implement it)As I know if I develop a shared Add-in by VB(or VB.Net) and in the add-in, I can get an Object of Excel.Application. By this Excel.Application object, I can get full control of Excel inside the Add-in. That means if I define a sub that load datamatrix from database and using the Excel.Application object I can populate the data matrix to the Excel.

I have done much research on internet and I now have built a shared Add-in for excel. I should say this add-in works fine without invoke the Excel.Application Object that I have tested. But when I call the Add-in function that invode Excel.Application Object from Excel I got an error as below:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Run-time error '2147467262'(*)
Unable to cast object of type 'System.String' to type Excel.Application

[code]....

View 2 Replies

Pass An Object Variable But Doesn't VB Force Decalre The Header As ByRef?

Oct 20, 2011

Why if you pass an object as byVal into a method is it then treated as if it were byRef? I know you're only passing the reference across when you pass an object variable but why doesn't VB force you to decalre the header as byRef?

View 2 Replies

.net - ByRef Underlined With "Expression Expected" Error When Trying To Pass In A Object Of Type List(Of ClsFooDetail)?

Mar 3, 2010

I work with C# 99% of the time. However, I'm having to update some legacy VB.Net code and encountering an issue with VB.Net code syntax. The error that I get is "ByRef" is underlined and "Expected Expression" tag shows up when you hover over "ByRef". The "FooDetail.Load" function is written in C# and expects a List object passed as reference. Don't have any trouble using the same function in other C# classes. Can someone indicate what is wrong with below VB.Net code.

Dim FooDetail As New clsFooDetail()
FooDetail.FooID = FooID
Dim lstFooDetail As New List(Of clsFooDetail)
FooDetail.Load(ConnectionString, "Stored Procedure", ByRef lstFooDetail as System.Collection.List(Of(clsFooDetail))

View 1 Replies

Byref New Object - Top Pass New Object As "byref"?

Sep 7, 2009

Below I tried to do an Example:

[Code]...

Below is the called method: Friend Sub SplitOU2(ByVal inDN As String, ByRef OUDN As Object, ByRef Organisation As Object, ByRef VerksamhetTyp As Object) By doing this I can skip to declare the in this example "useless" variable Dim VerksamhetTyp as Object = "".

View 3 Replies

Pass Variable By Reference And Set Object To Reference?

May 26, 2010

I pass this class i created a variable by reference and i want that reference to be assigned to m_Text so that when i change m_Text it changes the TextValue variable i passed. Example:

Dim test2 as String = "ok"
Dim test as New GeneTextBox(test2)

'then some one changes the text in the GeneTextBox and i want it to change the test2 string...

Public Class GeneTextBox
Inherits Windows.Forms.TextBox
Private m_Text As String
Public Sub New(ByRef TextValue As String)

[code]....

View 1 Replies







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