Variable Replacement In WMI Method?
May 5, 2011
I am trying to execute a command that works with hard coded variables, but when I try and replace the name test below with selectedname, I cannot get the syntax for escaping the command. The basic idea is I am using WMI to query the app pool names and then selecting one and storing in the slectedname variable, which works when I test with a msgbox(selectedname) line. It also shows up when I am stepping through, but does not get passed to the bottom command. The function where I am trying to execute the command is
Private Sub Stpbtn_Click(sender As Object, e As System.EventArgs) Handles Stpbtn.Click
Dim selectedname As String
[Code].....
View 1 Replies
ADVERTISEMENT
Jun 28, 2010
I am in the process of converting vb6 assemblies to VB.NET.I am trying to overcome a particular design challenge.I have a vb6 EXE sitting on a Terminal Server which is shared between multiple customers.Each customer has customizations in the form of overrides to this EXE in custom business logic contained within DLL's.We know what DLL to look at based on a setting in the database.We use the CreateObject ("CustomerDLLName.CustomerClass") method to create late bound objects.If the object is "not nothing", we check for override code.For example, if my base EXE has a sub called PrintForm, based on the logged in user I may use the base sub within the executable, or I may need to use the sub in a custom DLL:
Dim oCustom as Object<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
Dim strSetting as String<o:p></o:p>
strSetting = "Customer1DLL.Class1"[code].....
I am struggling to come up with a comparable if not better way to do the same thing in .NET. I want to continue sharing the base EXE so I can't just have separate EXE's and DLL's in separate folders.They all need to live in the same c:/Program Files/[Application Name] root directory so I can take advantage of the Terminal Server's shared application memory.
View 2 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 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
Mar 25, 2009
regarding this error: 'sqlquery' is a variable but is used like a method.Near the bold code is it gives the above error.
string[] sqlQuery = new
string[10];
for (int i = 0; i <= sqlQuery.Length - 1; i++)
{
char[] splitterequal = {
[Code]...
View 7 Replies
May 14, 2012
I am working in VB.NET Win forms and what I would like to do is create an object to use its properties.
The trick is that I want to create a reference to an existing class using a string variable that gets passed in to my method.
View 5 Replies
Jan 14, 2009
When I've used the remove handler method in my code, I get this warning:The 'AddressOf' expression has no effect in this context because the method argument to 'AddressOf' requires a relaxed conversion to the delegate type of the event. Assign the 'AddressOf' expression to a variable, and use the variable to add or remove the method as the handler.Why do I have to assign the "AddressOf" expression to a variable?
View 6 Replies
Mar 29, 2010
I have a piece of code that would be greatly reduced if a variable can be used instead of the actual method. (I am using a structure) kinda like the difference between the following code.
srrMulti.mthChildProp1.varRecall = strVarRecall
subPageRef
srrMulti.mthChildProp2.varRecall = strVarRecall
[Code]....
View 7 Replies
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
Aug 7, 2009
Sometimes to make a variable/method/class name descriptive I need to make it longer. But I don't want to, I'd like to have short names that are easy to read. So I thought of a special addin to IDE like Visual Studio to be able to write short names for class, method, field but be able to attach long names. If you need to - you can make it all long or you can make single name long. If you want to reduce it - use reduction, like two views of the same code. I`d like to know what others thinking about it? Do you think it is usefull? Would anybody use the kind of addin?
View 12 Replies
Jul 5, 2009
in vb I can do that
sub SetFocusControl(byref ctl as object)
ctl.Focus
end sub
in c# the compiler complaint that object doesn't have a Focus method
void SetFocusControl(ref object ctl)
{
ctl.Focus();
}
how can I do the same in c#?
View 3 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
Aug 24, 2010
Is there any way to know that a variable inside a method is Compiler generated.when decompiling a .net dll or exe the generated code looks like this. [code]
View 8 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
Jul 21, 2009
I want to assign the value of the integer returned from the InStr method to a variable. So, If TextBox2.Text = "The Apple Pie" And TextBox1.Text = "App", I want the integer returned, which in this case would be 5, put into a variable, lets say its called 'VarString'.
So VarString (would) = 5.
[Code]...
View 6 Replies
Feb 8, 2012
While a "for loop" is running in VB.net, C# or Python which method can be used to append each result to a variable?
View 2 Replies
Nov 28, 2009
While using the Socket.Receive method to receive messages through network, you should define a variable as the buffer and you have to specify the length like this: Code: Dim _ReadBuffer As Byte() = New Byte(LENGTH) {} My question is: What is the bad thing about increasing the length of this variable even if the received messages are sometimes shorter? (i.e. if some body let it 10000).
View 1 Replies
Jan 6, 2011
I have an interface ITest with a method GetResult(). I have a class Test which implements ITest and thereby defines private method GetResult().
Next I create an instance of Test in a different class. The code is as below:
Module NewClass
Public Sub New()
Dim i As ITest = New Test()
[Code]....
I am migrating existing code from VB 6 to VB.NET and hence I'm not supposed to change the access modifier of GetResult. Leaving it Private will throw InvalidCastException Unable to cast object of type 'System.Object' to type 'ITest'
Object type variable o is used in many places and hence I don't want to change that. And yes, Test implements ITest.GetMember with a different name.
View 3 Replies
Jun 20, 2012
Inside my .aspx I have some JSON code that looks like this:
[Code]....
Basically what I'm doing is pulling text from two labels on one page, and sending them to another page by calling the "doIt" function which looks like this:
[Code]....
Just so I'm clear, the "doIt" function and the JSON call are on two separate web forms. My problem is that with the "doIt" function being Shared, I can't access any global variables of the class. And if I remove the Shared, my JSON doesn't execute.
View 1 Replies
Aug 23, 2011
Will the list in this shared method keep its state throughout the life of the method? Or will a new list be created every time this method is called?
[Code]...
View 3 Replies
Oct 19, 2010
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]....
View 3 Replies
Mar 23, 2012
when i used vb6 i used csocketplus on winsock. i need a replacement of csocketplus , i need to create array in network socket
View 1 Replies
Apr 8, 2011
i have a C++ DLL. What i am doing is that i am passing memory address to my C++ dll where it write message on that address and i want to read the message from that memory address.
Here is my C++ function.
int _stdcall Test(int res, wchar_t *text)
Now in my C#.Net test app .. if i use unsafe char* .. i am getting proper output.
Declaration
static extern unsafe int Test(char* msg);
Implementation
[code].....
Now implementing in vb.net i am getting jst 1st character by using stringbuilder.
Dec
Private Shared Function Test(ByVal msg As StringBuilder) As Integer
Imp
[code].....
What is the replacement for char* in .Net ?
View 1 Replies
Jun 28, 2011
How to replace this string so that after the replacement work the string will be free of any spaces?
This is the string:
dim InitialString as string = "Hello world
View 2 Replies
Apr 17, 2010
I've been working on a project that requires that I can go around webpages with different proxies, user-agents, and clear cookies. Now after looking all around the net, it looks like there are some solutions for each of these, but I can never get them working. I was wondering if there was a wrapper for this control that fixed all of these problems or even just a different control I could include.
View 1 Replies
Dec 16, 2009
I only found one GINA replacement called pGINA but it is in C++ which I don't know at all.Does anybody know one in either C# or VB.NET?(I'm writing software for use at work to control what employees are doing)
View 3 Replies
Apr 26, 2011
I was trying to put together a solution to:Insert spaces between words on a camel-cased token..Essentially, he wants to turn 'ThisIsATest' into 'This Is A Test'. I thought, 'Oh, that's easy, I can do it with LINQ' but I struggled with it. [code]Is the path I started to go down, but I'm having trouble getting the results into something I can work with. I even added the .ToString to try and get back an array of Strings, but I'm still getting an error.[code]I believe that means I'm getting a collection of System.Char, System.String instead of just a System.String like I want.
View 3 Replies
Nov 30, 2010
How fast can I replace characters in a string?
So the background on this question is this. We have a couple of applications that communicate with each other and with client's applications through sockets. These socket messages contain non printable characters (e.g. chr(0)) which need to get replaced with a predetermined string (e.g "{Nul}"} because the socket messages are kept in a log file. On a side note, not every log message will need to have characters replaced.
Now I started off on this little adventure reading from This MSDN link which I found from a different post from this site.
The current method we used...at the beginning of the day...was using string builder to check for all the possible replacements such as...
Public Function ReplaceSB(ByVal p_Message As String) As String
Dim sb As New System.Text.StringBuilder(p_Message)
sb.Replace(Chr(0), "{NUL}")
[Code]....
This so far has been the fastest way I have found to process these messages. I have tried various other ways of going about this as well like converting the incoming string into a character array and comparing along with also trying to loop through the string rather than the chrArray.
View 5 Replies
Aug 18, 2011
replacement for winsock in vb9?
View 1 Replies
Jun 29, 2010
I need to develop an project in VB.Net 2005 or 2008 and SQL 2005 for the database. It is not possible to create an App Config file(To create an connection to the Database).Is it possible to use/create an connection with similar functionality, and what is the replacement of this function.
View 1 Replies