Name Of Currently Executing Method?
Dec 28, 2009how to get the name of the currently executing method? I was thinking it was somewhere under My.Application, but I can't find it...
View 4 Replieshow to get the name of the currently executing method? I was thinking it was somewhere under My.Application, but I can't find it...
View 4 RepliesI've taken up learning vb.net having come from a C# background.
I was trying to reprogram a simple C# winforms program I had, which took command line parameters to determine what it did. In C#, there is always a main method to accept these arguments.
From what I've read, vb.net implements a main method for you once you specify the starting form, unless you make one yourself. Which is fine, but the one I've implemented seems to get ignored, I've put break points in to see if the code even get looked at, but nothing. The main sub is in the class declaration of the startup form like so[code]...
I'm returning to my old question since I've never been able to find an answer.
For example I have a class library A with a method Method, is there a way to load this assembly from my application B and execute this method (A.Method) without putting a reference to assembly A?
My idea isn't that the idea behind System.Reflection?
So far, I can only load the assembly, I can even enumerate classes, members, etc, but I cannot figure out how to invoke methods and read property values.
I am unable to crack this as the end user requested to show some kind of progress bar while running a long time method or an update statement. Kindly suggest me on this ASAP.
View 5 RepliesI am using a .Net JavaScript implementation called Jurassic to run user-controlled scripts within my .Net 4 WPF application coded in VB.Net - C# answers are fine. The script engine runs on its own thread and provides an API for the script to interact with my application. This all works really nicely until a user executes a script that causes an infinite loop and takes out a core of the processor.
[Code]...
The reason I care about keeping the thread alive is because the user who wrote the script and the user who is running it may not be the same, and I want to keep the experience as smooth as possible the the user running the thread. There also might be legitimate situations in which a single JavaScript function would run for a long time and I do not want to kill that, I just want to stop being allowed to hog the resources.
Solutions that involve stopping the thread from slowing down the system but that still show high CPU usage are not preferable because I do not want the user to wrongly feel that the application is resource intensive.
Consider a MyForm class that contains a shadowed implementation of Show(). It also contains a CreateForm() method, which accepts an instance of the form and calls the shadowed sub:
[Code]....
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 RepliesI have a large problem with inheritance in vb.net. The problem is the following:
I have 2 forms => frmBase and frmChild
In frmBase i want to create a method Called StartWorking() and i want frmChild to inherit this method.
But here is the tricky thing: when frmChild.StartWorking is called i would like the following => without calling MyBase.StartWorking()
I want frmBase.StartWorking() to be executed first and after a test in frmBase.StartWorking if blnValue is true then frmChild.StartWorking has to be activated. if blnValue is false that frmChild.StartWorking cannot be activated.
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]....
Write an overload for every numeric type or if possible constrain a generic extension method to just numeric types.
View 2 RepliesI just need to know what is the slight difference between them so I know which one to use everytime.
View 5 RepliesI will try to explain what I need.Let's say that I have a class like this:
Public Class Example1 Public Sub ToBeCalled()
[Code]...
When I am loading an Assembly dynamically, then calling a method from it, I appear to be getting the method from Assembly executing before the code in the method that is calling it.It does not appear to be executing in a Serial manner as I would expect. Can anyone shine some light on why this might be happening. Below is some code to illustrate what I am seeing, the code from the some.dll assembly calls a method named PerformLookup. For testing I put a similar MessageBox type output with "PerformLookup Time: " as the text. What I end up seeing is:
First: "PerformLookup Time: 40:842"
Second: "initIndex Time: 45:873"
Imports System
[code].....
Why does my the declaration of my string in the code result in the following error? Is there a workaround?
Code:
<script runat="server">
Protected Sub form1_Load(sender As Object, e As System.EventArgs)
Dim x As String = "</script>"
[code]....
Error: Statement cannot appear within a method body. End of method assumed.
Note: The following page did not fix my issue and instead resulted in the string </script> being output in my page. ( VB.NET hates </script> tag in string literal )
I am not sure whether this is a trick question?One of the object i have has 2 boolean properties, Standing and Sitting.I have a class called student with the 2 methods stated below- Am I coorrect is assuming that the first method draw() is affected by the standing property AND not the second method?Also the way it affects is that it draws an image when the the stugent is standing?
[code]...
What's the equivalent method in .NET of the Picture1.Scale (0,0)-(10,10) method in 6.0?
View 2 RepliesLet's say I have a page Test.aspx along with test.aspx.vb.Test.aspx.vb contains a class name "TestClass". In that class I have method1(), method2() and method3()I need to be able to call one of those methods, but I can't hard code it, the method to be executed comes from a string.
I can't do
Select Case StringContainingTheNameOfTheDesiredMethod
Case "Method1"
[code]...
Extension methods are useful for types that you don't own and can't/don't want to derive from and extend (e.g. reference types and interfaces). Obviously, interfaces should be kept as short and to-the-point as possible, so extension methods for interfaces are particularly useful (e.g. LINQ).For classes, especially classes that you own, they're still useful - but I'm wondering how you determine what should be an extension method or what should be a method in the class itself.Personally, every time I think about it, I keep going round in circles with the following thoughts:If it's useful enough, it should be in the class.It's not part of the core responsibility of the class, it should be an extension method - but if it's useful enough, surely it should be the responsibility of the class...
View 3 RepliesI 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]...
y question is I have a program that is used to add inputs to an array when the OK button is clicked. My problem is that the after the first click of the OK button the Do while loop does not execute again for a 2nd click.lling out my hair. Here is the code.
Public Class InputValue
Public Shared InputArray(0 To 9) As Integer
[code].....
we want to write a DLL using VB.NET 2008 using .Net 3.5 that performs an HTTP request we then want to call the DLL From SQL Server 2005 (in a trigger) and pass the DLL some variables and get a return value.Where im at in the process.I have created the DLL 'HTTPDLL.dll'
Source:
Imports System
Imports System.Configuration
Imports System.Collections.Generic
Imports System.Text
[code].....
Perhaps i am calling it incorrectly but i havent been able to get it to work (always return 'invalid class string')
Just trying to run a basic program where the user is prompted to enter five names, one at a time. I'm prompted one time. After entering one name I get the following error "Unhandled exception: System.NullReferenceException:Object reference not set to an instance of an object"
Here's the
Module Module1
Sub Main()
Dim SortedList
For SortedList = 1 To 5
[code]....
im working in a windows app that execute another apps.. writing the name of the app in a text box (i.e firefox.exe) and click enter to run it im using >> (System.Diagnostics.Process.Start(app_name.Text)) to run apps it works fine with me .. but it didnt with some apps like when I write for example ares.exe it says:Win32Exciption was unhandled :The system cannot find the file specified
View 1 RepliesI am running SQL 2005 Standard Server. I am using Visual Studio 2010 for development.
Let me just say that what I have below works, I would just like to have some constructive critisism.
CODE:
I'm trying to execute a SQL command, but I just can't find out why this is not working.This is how I defined the "execute" function in my class named "clsSQL":
[Code]...
I have the following code:
Code:
Imports System.Data.SqlClient
Imports System.Data
Public Class Main[code]...
and the sub Exceptionquery is not working. I can verify this because it is supposed to create a new table called scratchpad3. what I may be missing in that sub routine that isn't allowing it to work?
I have two if statements and my project sees one and not the other. Here is the code:
If (IsPostBack) Then
HandleUploadedFile()
End If
Dim savePath As String = "Images "
If (fileUpload.HasFile) Then
[Code] .....
When I trace my code I find it goes to the second if and then go to end if without running the code inside the conditional.
I have a sub in which I call different subs, depending on a value I pass through. It works fine for all but the last one. It executes the sub I call but then comes back to the first sub and runs the second one again
[Code]...
I am compiling and running code at runtime. Can I stop this code midway through if I wish? Like the 'stop' feature in Visual Studio that stops the code if desired?
View 2 RepliesI'm trying to eliminate a VB.NET button on my aspx page. Trying to use javascript and ajax to execute the same code my vb had.I put in a script manager, set EnablePageMethods to true, added a static subroutine, and referred to it in my javascript function (BTW -- this seems a lot of work just to execute an existing subroutine). The javascript calls my code-behind and it almost works.Problem is, now I'm getting a NullReferenceException when SimulatePrintBatchClick tries to do anything with the controls.
Error is 'Object reference not set to an instance of an object', line is 'pnlVars.Controls.Clear'
Here's the code from UW.aspx:
<WebMethod()> _
Public Shared Sub PrintBatchFromJSWM()
Dim UWI As New UW
[code]....
when I run the above code in PrintBatch_Click it all executes just fine. I really don't understand why it bombs out as a subroutine.
Perhaps this is not the way to do this, but I'm at a loss for finding a different way. Originally this code was handled by an ASP/VB button, but the specs have called for it to be deleted.