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
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
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.
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)
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.
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]....
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)?
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.
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:
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>
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.
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.
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
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?
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]...
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]...
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
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]
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]...
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.
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?
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
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?
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))
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 = "".
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)