Wcf - Execute A Method On An Existing Process Instance?
May 16, 2012
I have a windows service that I have been writing in Vb.Net. As part of this service it calls a class that has a long running Process.I can execute commands to this process when I want to via the ServerCommands() class within the service, however I want to call these remotely. Possibly from a website or click once WPF application.
For this I have used a simple Tcp.Ip WCF example, and have verified it as working correctly.
This called OnStart()Private _serverCommands As ServerCommands
Protected Overrides Sub OnStart(ByVal args() As String)
Add code here to start your service. This method should set things
in motion so your service can do its work.
[Code]...
It appears that in debug _serverCommands is Nothing when it should be running.How might I go about ensuring any command I execute through WCF communicates with the running instance instead of creating a new ServerCommand() instance??I haven't tried WCF before, so I might be hitting a dead end... however I'm sure its possible.
View 1 Replies
ADVERTISEMENT
Oct 24, 2011
In the same class I have
Dim WithEvents YMDChart As Chart
Dim WithEvents YMDChartArea As ChartArea
Then:
Public Sub PlotYMD() handles ButtonPlot.click
YMDChart = New Chart
[Code]...
But here at line 5 I have an error saying that I am not refering to an existing instance whereas I am.If think it is because at this step the YMDChart is dead even if it is present on my form. I have tried with the declaration "Static" but it is only possible within a method and is incompatible with "with event".
View 3 Replies
Mar 17, 2009
I have a program that runs some data manipulation on a file when it is double-clicked and then displays this to the user.However, when I double click on the same file type of a different file it opens in a separate instance of my program instead of the same instance already running, i.e. some message that says would you like to reload file, YesNo, and then given the answer perform the action required.I have found some code to stop a second instance from opening, but this is inconvienient for the user to close out of the program everytime they want to view a new file.[code]
View 6 Replies
Nov 13, 2011
I am currently building a vb windows form application (.net 3.5 framework). For the next part of the application I want to be able to use an existing excel process which will have been checked out from sharepoint and manipulate the worksheet with my app.
View 1 Replies
Jan 19, 2012
I've been trying off and on for a week now to get this to work but no luck. I have completely stripped down my vb.net 2008 windows service to just create a vbs file and launch it using a process.I'm dying here. The vbs file creates and is valid. I can execute it manually, the windows service just won't run it!! I'm on a windows 7 machine and the process is compiled and installed as a 32 bit process. It is also installed as local system.
After the process tries to execute, I created a text file and it did so successfully. So, I know that the service isn't crashing out.[code]....
View 2 Replies
Sep 24, 2010
Suppose that I want to implement another method for a class namely hasFiles for System.IO.Directory , How can I do that?
for example if I add <Extension()> _ tag before each function or Sub I can add a new function or method for each Control.
View 3 Replies
Aug 21, 2011
ProcessWindowStyle.Maximized for an existing (already started process)
View 6 Replies
May 8, 2009
I have written a method to replace multiple characters in a string. Is it possible to overload my own method to the existing method "Replace" in the String namespace?
Function Replace(ByVal inValue As String, ByVal ParamArray replacechars() As String) As String
For i As Integer = 0 To UBound(replacechars) Step 2
[Code].....
As you can see it have a different signature from the public method so I think it would be nice to have my method overloading the existing method
I can live with it if it isn't possible. See it as a "nice to have"
View 2 Replies
Oct 18, 2011
I need to execute commandpromt process async and get the output of the execution. i currently have this code
Public Function ExecuteCommandSync(ByVal command As Object) As String
Dim result As String = Nothing
Try
[Code]....
View 1 Replies
Jun 10, 2009
I am using the code below, but it still shows the program.For example, if I pass in CALCIt will start the calculator but show it.
Code: Public Function ExecuteFileHidden(ByVal lFile As String, ByVal largs() As String) As String Dim oSTR As String = "" oSTR += "Attempting to execute " & lFile & vbCrLf Try Dim p As New System.Diagnostics.Process p.StartInfo.FileName = lFile Dim a As String = "" For Each l In
[code]....
View 1 Replies
May 13, 2011
In VB.NET, how do I do the following?
Execute a Stored Procedure
Read through the DataTable returned
View 2 Replies
Jan 21, 2012
I have some VB code like
Dim data As DataTable = DataAccess.ExecuteDataSet("AuthenticateWebServiceClient" _
, New SqlParameter("@ClientID", ClientId) _
, New SqlParameter("@Password", Password) _[code]....
Except PrepareSPCommand isn't recognized by VS. Does anyone know the correct way to convert this function to C#.
View 2 Replies
Nov 16, 2010
I have a UserControl, we'll call it myUC, that is one among several UserControls in the main window(myWindow) of my WPF application. myUC contains a number of standard controls, one of them being a button, we'll call it myButton.
When I click myButton, I would like to execute myMethod, which exists in the code-behind of myWindow.
The problem being that myUC doesn't have any idea that myWindow even exists, much less that myMethod exists.
How can I send the message: 'Hey, myWindow, wake up. myButton on myUc was just clicked; run myMethod'?
View 6 Replies
Sep 3, 2009
I have simple ASP.net web form. With a simple click on a button i need to call a the Multithread process in order to execute my querry in SQL Server DB. I know that my querry willl take up to 45 min to be executed. While the process is running i need to display some status information like: Starting time, Time elapsed, % of completed...So after running the process i got the following error message: "Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."So i have 2 problems to fix:
Avoid getting timeout while processing/calling the stored procedure. I tried to add cmd.CommandTimeout = 1000 but it didn't work out!
Display correctly Time elapsed and % Completed while processing.
Here's my code in the main form:
Imports System
Imports System.Data
Imports System.Configuration
[code]....
View 3 Replies
Nov 15, 2011
I'm designing a .NET-Type at runtime by using the Reflection.Emit-Namespace. Currently, I'm about to generate a method which invokes an already existing method in the generating class:
[Code]...
View 1 Replies
Oct 16, 2010
Is it possible to compile my VB.NET project with a specific process name so that I can code to ensure that user cannot run multiple instance of the program?I have researched on the internet and found out most of them validate by process name. However, I have done a test which simply changing the exeuctable file to another name, the process name changes in the task manager as well. Thus, I don't think validating through process name works unless I can specifically assign a process name in the VB.NET project or validate through other ways?
View 3 Replies
Aug 21, 2009
I'm working through a book that does not provide a lot of example code and what it does provide is in C#. The book refs vs 2005 but I'm using vs2008. The author asks for the user to create a solution with two projects, one winforms and the other a class library (called DependentAssm). The class library is added as a reference to the winforms project In the class library, he asks one to create a new class called SayHelloComp. The project created a file called class1.vb, and a class called class1 which I renamed to SayHelloComp. I left the file name alone, that's ok right?
View 4 Replies
Oct 13, 2011
I'm getting "Me' is valid only within an instance method" error when I convert function to a PageMethods. [code] If I remove Me, I get different error.I got this shopping cart script somewhere online and I'm not sure what to replace "Me.objDR" with something else.
View 3 Replies
Nov 4, 2010
I have been thrown in at the deep end with an existing VB.NET project at work. I have never used VB.NET before so I am struggling a little. Does anyone know how to solve the following.I need to pass an instance to client side and then pass it to a shared method in order to access instance methods from when the shared method.The starting point is a fileupload control within the HTML of my Contacts.aspx file:
<asp:FileUpload ID="DocUpload1" runat="server" onchange="CallMe();" />
The onchange event calls a javascript method, see below, this uses AJAX PageMethods to called a Shared method in my code behind This is the script code which is in my Contact.aspx file
[Code]...
If anyone knows the solution please could they update the code as I probably won't be able to understand if you just give a description. I just hope I am along the right tracks.
View 1 Replies
Jul 12, 2010
Can I make an Extension method for all the subclasses of System.Object (everything)?
Example:
<Extension>
Public Function MyExtension(value As Object) As Object
Return value
End Function
The above functions won't work for object instance:UPDATE The problem seems to occur only in VB, where members of object are looked-up by reflection (late-bound).UPDATE AFTER ANSWERED.FYI, as vb has an advantage that C# lacks that is, members of imported Modules are imported to the global scope so you can still use this functions without their wrapper:Dim myObj2 = MyExtension(myObj1)
View 6 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
Nov 19, 2010
Basically, I've got this plugin-based application I've used all the time in VS2008 flawlessly. In my current project (VS2010 by the way) I wrote a plugin for the application and whenever I try to use an instance of a particular class (in an external dll) from my plugin, I get an error.
I tried watching the instance and I got the message:
"Cannot find the method on the object instance."
in the watch window. This has never happened before! I also found that some of the extension methods in the plugin does not work.
View 2 Replies
Aug 27, 2010
Is it possible to prohibit an instance of a class from calling a shared/static method?
For example:
I want to allow this:
ClassName.MethodOne()
But I want to disallow this:
Dim A As New ClassName
A.MethodOne()
The reason this is desirable is that in this case it is semantically confusing if an instance can call the method.
View 2 Replies
Jul 13, 2010
I have an application the contains several excel files bundled with it. I'm not opening the files and processing them within my application. These files contain a data-connection to reload all of the pivot-tables within each excel file. I have a 'link' on my form, that when clicked, it determines which file to open and calls a sub using filename and executing Process.Start(filename) for any excel file I want to open. I have no problems opening any one of the files and then exiting excel.
The problem is when I 'close' a file, but don't exit Excel; then try to open another file(clicking link on form)... it creates a new instance of Excel.
I know from experimenting that the fileopendialog form will 'reuse' an existing Excel instance, IF it does not already have a file open.
How can I do the same thing without using the fileopendialog?
I don't want the end-user to have access to the folders where these files live. That's why I have multiple 'links' on my form, one for each xls that already exists. I just want them to be able to click on a link and the xls file opens AND if they choose to merely 'close' a file and not exit... Don't create a new instance of Excel, but re-use the existing one.
View 5 Replies
Nov 15, 2009
When an instantiated class calls a method in the parent form class, VB.NET starts a new instance of the form class instead of calling the method on to the active one.How do I tell it that I have just one instance of my form class, or that I don't want to create a new instance of the form and just call the method on the already active form?
View 2 Replies
Jun 5, 2011
If I have a very large function/sub in a class that is an instance method (i.e., not Shared), do I gain or lose anything by moving that to a shared method and then declaring a small stub method for the instance use?
I.e., I go from this:
Public Sub MyBigMethod(ByVal Foobar As String)
If String.IsNullOrWhitespace(Foobar) Then
Throw New ArgumentNullException("Foobar")
End If
[Code] .....
My thinking is I save on memory size per each instance of the object. Because each instance only has to lug around the stub method which handles calling the shared version and passing an instance of itself to the shared method so that it can do whatever it needs to do. But I'll wager that I sacrifice a very teensy amount of speed because of the added function call overhead.
View 1 Replies
Feb 16, 2009
I'm trying to search a generic list of 'User' business objects which has a property called 'Username': If (From u In colUsers Select u.Username Where Username.Equals(strUsername)).Count > 0 ThenI keep getting:Delegate to an instance method cannot have null 'this'.
View 16 Replies
Mar 30, 2011
Problem that you may have when dealing with two objects that are raising some events. Here, to make it obvious, I am closing the form, but the problem can be experienced with any other 2 classes event. First, what is the problem !
Let suppose that by pressing a button, you want to raise a custom event, then execute a method and then close the form
In that case, you may use a code similar to this
Event BeepIt()
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RaiseEvent BeepIt()
[CODE]...
View 14 Replies
Mar 12, 2011
Under Visual Basic 2010, I am trying to define a specific instance of a static method that was created as a Java class. I have a vendor supplied dll added in as a reference.[code]...
But, I can't seem to define a specific instance of this method. Using "IntegrationMethod.getIntegrationMode()"always returns a value of zero.
There doesn't appear to be any way to "setIntegrationMode" to a specific value.
The documentatoin for this Class as provided by the vendor are shown below.
When I asked the vendor for assistance, their response was: "
Our javadocs for the IntegrationMethod class show that we provide three predefined instances of the IntegrationMethod class[code]...
View 9 Replies
Sep 26, 2010
Use the "new" keyword to create an object instance & Check to determine if the object is null before calling the method. I'm reading text from a text file using the following [Code]
View 9 Replies