[2008] Call Method Through Variable?
Mar 12, 2009
I using VB.NET (VS 2008). I want to know if I can call a sub whereby the name of sub is in a varialbe.
For example :
Private Sub Hello()
Msgbox "Hello"
End Sub
[code]....
I know it does not work that way but how can I call a function or sub using a variable and not directly.
View 10 Replies
ADVERTISEMENT
Mar 9, 2010
If I have a string that contains the name of a control is there a way to call that control's click event?
Dim a as string = "MyButton1"
Now I want to call MyButton1.Click Method or MyButton_Click Event using the contents of a.
View 7 Replies
Oct 14, 2009
I have 2 question, hope somebody give me an explanation: 1. Should a local variable call dispose method and set to nothing? 2. If some method have an arguments which it is a ByVal argument, it means a method create a new object? But If it is a ByRef argument, it means a method don't create a new object?
View 4 Replies
Jun 3, 2010
Is it possible to dynamically load a .NET DLL and create an instance of a class inside it? I will know the name of the class.
View 5 Replies
Feb 7, 2011
I am trying to use the value of one variable to call another variable of the same name.I have 2 variable one called VAR1 and VAR2.
The variable VAR1 has a value of "VAR2"
The variable VAR2 has a value of "HELP"
I want to be able to get the value VAR2 from the variable VAR1 I have defined the value of VAR2 early in the code and now I want to call that value by using the value of VAR1.The reason I am doing it this way as I have a list of 50 variables that are pulled from one system. Each of these variables have the same name as the columns of a spreadsheet. The total number of Variable stay the same but the total column headers may vary each time. I need to loop through each of the column headers match them with the variable names and add the data to the spreadsheet.
VAR1 = "VAR2"
VAR2 = "HELP"
i =1
[code]....
This is the tricky bit...if the value of the cell(1,i) = "VAR2" How do I get it to display the value of the variable of the same name In this case how will I get it to display "HELP" when I only have from the VAR1 value "VAR2" I know my code will bring back the value as a string but I want it to bring back that string as a variable and display the value of that variable?
View 9 Replies
Feb 16, 2010
im making a transport agent for exchange and am getting hung up on how to call a method asyncronously. Im doing this based on an msdn article but like usual they didnt provide the part of the code i need to figure out.the article is in C# but i converted it to vb in my project. [URL]I know I need to setup a delegate for the method and then invoke that delegate, but im not 100% on how to implement this.
Imports Microsoft.Exchange.Data.Transport.Routing
Imports Microsoft.Exchange.Data.Transport
Namespace TestTransportAgent
[code]....
View 2 Replies
Apr 7, 2010
I have created a project using VB.Net(VS2008) and created the exe file. I have another project in VBA (Excel 2003). The project basically IC-Testing based. So according to the device type the Excel workbook name varies. For example I have AAAA.xls, BBBB.xls, CCCC.xls. When I open AAAA.xls, I want to call the .exe (which is developed in VB.Net) with the variable "AAAA". i.e when the exe program runs, it knows which Excel is opened or from which Excel the .exe is called. now I am using Shell retval=Shell("d:Monitor.exe",1). Using this the exe is called and running fine. But the Monitor.exe doesn't know which Excel called it, whether it is AAAA.xls, BBBB.xls or CCCC.xls.
View 1 Replies
Nov 12, 2009
Does calling the Dispose method on a Windows.Forms.Timer call it's Stop method? Or should I stop the timer before I dispose it?
View 5 Replies
Feb 16, 2010
I will try to explain what I need.Let's say that I have a class like this:
Public Class Example1 Public Sub ToBeCalled()
[Code]...
View 5 Replies
Jul 17, 2009
how do I refactor all my instance variable to have all the get and set method? I tried RefactorVB but it seems like it can only refactor 1 by 1.
View 2 Replies
Jan 29, 2012
I have a Application that Crypts all Files in a Directory and the Subdirectories
Public Shared Sub CryptAllFiles(ByVal crypt As Object)
'check if this dir exists
Dim vDirInfo As New DirectoryInfo(vPath)
If Not vDirInfo.Exists Then Exit Sub
'get all files' sizes in current path
[Code]...
View 3 Replies
Dec 18, 2010
I have nine pictures that I need to animate -I need to use the ToString method and a counter to concatenate a file name into a string variable from the Image.FromFile method. Once the counter reaches its maximum value, and the last picture is displayed, the counter should be reset to zero or one depending on how the first image file has been name. Also a static counter variable should be incremented in the time routine. what I have so far -- I know what I have to do; however, I just do not know how to code this properly.. Right now I have this going thru a button procedure but it needs to go through a timer.
[code]....
View 2 Replies
Mar 17, 2012
i want to which way is better when concentration is on processing speed. i want to call a method that compute some data that method is on another form in my windows form application then what you prefer is better way 1) to call that method in another form and use returned value or create similar method in form where it is required.i want to make it's processing fast.
View 3 Replies
Jun 27, 2011
Assume I have a function: Protected Sub UploadFile(file As String)
End Sub Then I can do the follwing
UploadFile(file)
But I would like to do this: file.UploadFile()
Looks like Im missing logic in here, but still - is it possible to make dot-like notation?
View 2 Replies
Dec 29, 2009
I have a class that runs as a thread. While the thread is running, I want to call a method in that thread. I do this commonly where a thread calls a method in the GUI with a delegate. But I'm confused how to do this when the called thread is not the GUI and there are no parameters passed to the called method.
View 8 Replies
Apr 3, 2009
may I just ask a seemingly simple question for which I can't find any solution throughout all the VB.NET documentation: I have to call a (non-static) method of another object (instance!) based upon the name of the method (given as a string).
View 1 Replies
Jun 21, 2010
I have a Form1 with a method called OrdreUpdate2 I try to run thad method from another form by using the command Form1.Ordreupdate2 in a buttonclick.
But nothing happens..What am I missing here?
View 1 Replies
Nov 5, 2010
I have a form and I am calling a method from a module in that form. However, how to do i call the object into the method, since Me doesn't work.
Example:
in the module:
Function printname()
Console.WriteLine("Form called with is titled:" + me. text)
[code]....
View 7 Replies
Jan 27, 2011
In VB .NET, when you create a user control class, you have the obligation to call the sub InitializeComponent within the constructor.If you don't you'll a warning message like this: [code]What is the mechanism used to raise this warning? Is it something I can reproduce for my own functions?
View 1 Replies
Apr 6, 2011
i have a problem i use a call sub procedure to do a delete records in my database for my vb .. now i have a problem when i call my sub delete proceudre in like this call GetDelete("tblName") , but in the sql query the sysem declare like this delete * from 'tblName' in my sub procedure when i set the breakpoint in which cause an exception error "Syntax error in query. incomplete query clause " anyway how to delete the quotes so i can retreive it without error
View 2 Replies
Jul 22, 2009
When should I call the Flush() method (TextWriter.Flush() / StreamWriter.Flush() / BinaryWriter.Flush() / etc) ? Should I call it everytime I finish writing a stream?
View 3 Replies
Mar 3, 2010
I have a method written in VB.NET. It looks like this:
Shared Sub SomeMethod(ByVal Id As Guid,
Optional ByVal str1 As String = "foo",
Optional ByVal str2 As String = "")
I want to call this method from C# 3.0 and I want it to use its default arguments. I tried passing System.Reflection.Missing.Value, but I cannot cast it as String. Is there any way to do that?
View 3 Replies
Jan 31, 2011
I want to calculate the time taken by a method to execute.[code]...
View 11 Replies
Oct 28, 2010
I have a C# dll and want to use it in VB.NET. I'm using C# 2008 Express and VB 2008 Express. I have added a reference in a VB project to the C# dll. When I create an instane of a class in the C# dll, it gives the following error messsage: "Type 'RF.RabinFingerprint' has no constructors". My C# dll code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;[code].......
View 3 Replies
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
Jan 3, 2011
REF: http:[url].....The above reference is where I got the code below.This code adds buttons to Form1. When a button is clicked a messagebox appears stating what button was clicked. I want to have the ClickHandler fill a RichTextBox on Form1 (I added a RTB to Form1). My problem is I can't do a Dim xForm As New Form1 to fill the RTB from the ButtonArray Class. I can place my file's text in a MessageBox so I know the code I added is correct. I also tried placing a Property method on Form1 and using a Accessor to fill the RTB, however it also requires Dim xForm As New Form1. How can I get my data from files to the RichTextBox on Form1 from the ClickHandler in the ButtonArray Class? See ButtonArray Class Below.
Imports System.IO
Imports System.Text
Imports System.Collections.CollectionBase[code].....
View 5 Replies
Jun 8, 2009
I am trying to call a method which has two parameters using thread. How can I do this? If I pass parameter to my thread.start() method, it is giving error.
View 1 Replies
Apr 30, 2012
I am new to Silverlight, but am up to my ears in some of the more intermediate/advanced stuff.
I am using MVVM, in Silverlight 5.
I have a view (we'll call it ComboView.xaml). It has a ViewModel (we'll call it AwesomeVM)
The view contains the ViewModel, declared in the page's resources like so[code]...
View 1 Replies
Jun 3, 2010
i have an excel template and there was a chart there, I was confuse on how can I call that chart when I'm coding in vb.net.. how can I call the chart for me to set the new value to fill the chart..
View 1 Replies
May 15, 2012
I have a asp.net web application with jquery controls. I have a datagrid that will display data from a database table and created a WCF Service to access the db and return the data. I want to be able to call the WCF service from this application which is on a different server and have the xml data returned, converted to json format to be used in the datagrid which is a jquery widget. I have tested the web service and it works fine. Should I call the web service from the javascript function within the xml or create a .net method behind that calls the service and then does the conversion? From these how would I get started?
View 1 Replies