Passing Argument To Shell()?

Jan 5, 2009

I'm designing an interface using visual basic .NET with visual studio tool. In my program I have to call an extern .exe using the function shell() and pass a FileName to it. The problem is that what it passes to the executable is never the file path. My code is this one and I think it should work but I don't know why, it doesn't.

Public Class FormMain
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code].....

View 15 Replies


ADVERTISEMENT

Argument Passing In C# And .NET?

Jan 14, 2012

In VB.NET, can we pass an original object as an argument without instantiating it? For example, I have two forms in my project formA and formB. Now I have this code.

[Code]...

Apart from this, in VB.NET in any class like formA, if I type formA, I can see all the objects and controls present there but not in C#. Again, I have to make a new instance to see all the controls. This becomes a problem if I want to manipulate two running and working instances with each other. So what basic thing am I missing here?(I am an amateur programmer migrating from VB.NET to C#. Things are going nice and clean expect for the ones I've recently figured out.)

View 3 Replies

Passing A Type As An Argument?

Aug 12, 2010

I'm using VB.NET 2003 with .NET Framework v1.1. I know it's getting a bit old now but I'm stuck with an existing program and don't have the time/knowhow to convert it to anything newer.

My question would probably be solved very easily with Generics in .NET 2.0 but as I can't use that right now, I'd like to know if the following is possible:

I have a load of manager classes which inherit from DictionaryBase and hold collections of my custom classes. For example, I have a Employee class, a Batch class, a Supplier class, etc... and each of these has a Manager classwhich holds a collection of them - eg: my PlantTrayMgr class holds collections of PlantTrays, etc..

I have one particular form where I have to populate loads of comboboxes with the contents of various Manager objects. What I currently do in my form load event to populate comboboxes is this:

Code:
Option Strict On
Option Explicit On
Private _plantTrayMgr As PlantTrayMgr

[Code].....

View 4 Replies

Passing Argument Into Dll Call?

Mar 7, 2010

In my vb.net code I want to call a dll file created by Qt4.

Now everything works fine untill and unless I pass some string argument to the function.

Here is the function in dll file:

const char* QtEngineDll::randInt(char url[])
{
QString result;
/*QTextCodec *codec = QTextCodec::codecForName("UTF-8");

[Code]....

When the function returns some constant value, say if i put result = "Abhijit" then it returns the value properly. But if I want result to return value url the it is returning some garbage values.

View 8 Replies

Passing Argument To Or From A FORTRAN DLL From .NET?

Feb 1, 2010

I have a DLL written in fortran that I know works because I am getting it from a working software package that we use daily. I am trying to call it from anything but am having problems i believe with passing the correctly formatted arguments in and out of it, so i decided to try and access it from a VB program. I chose VB because I have contacted the developer of the software package we are using and he gave me his DLL function call in VB6, even though he is not allowed to show me the FORTRAN source.

Problem is (perhaps, i think) that I am writing in VB.NET, which has different data types than VB6. Can anyone see why i am am having problems. The error i get upon running is: "AccessViolationException was unhandled: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

[Code]...

View 3 Replies

Passing Array As Argument?

Feb 28, 2010

When I try to do the same in .net the "array argument" value of the second sub is either Nothing or I get an error saying "Value of type 'String' cannot be converted to'System.Array'."I've tried converting the array to a system.array but it will not hold all the Types of data it needs to hold. (I tried 3 days ago and don't remember what Types would cause an error. My 1st value is a string and the second is an integer and this caused some error.)

View 1 Replies

Passing Url Based Argument

Mar 27, 2011

I have written an application to register a url type extension at startup so in short if user inputs dld:// in any browser it loads my app now, what I want to do I want to somehow move a bit further like if user goes dld://about the application loads and shows the about page

View 5 Replies

Change Variable Value When Passing As Argument

May 18, 2012

is there a way i can do like this in vb.net

[Code]...

what i want is that idx keeps incrementing after each line, without incrementing it on a seperate line.

View 1 Replies

Force Passing Argument Byval?

Sep 16, 2010

I have an old unmanaged dll function and I want to pass an array to it.The dll function expects the array to be passed by reference.Sometimes I can do that and sometimes I need to pass a pointer in a variable.Is it possible to override the declare for the function so that I could pass either the array by ref, or a pointer to it if I need to?

View 15 Replies

Passing Command Line Argument?

Dec 15, 2011

I am a beginner using Visual Studio Express 2010 to create a small console app to use as a utility accompanying another primary app that can pass a command line to the utility. I would like to set it up so that the utility will not run independently but only run and load its only form (Form1) if it is launched by the primary app using a "/run" command line parameter. (I can set up the primary app to launch and pass a command line parameter. I need help with the utility's code.)

The utility already has some VB code, so I need to figure out what code to add to receive and act on the " /run" command line and even more challenging for me, where to place this new code so it works.

pseudo-code:

initial event to read the command line, then if it is " /run" load Form1, else do not open and run utility app.

View 13 Replies

BackGroundWorker Passing Argument In RunWorkerCompleted Event?

Jan 15, 2012

my current solution as you can see is by using shared variable within a class in order to pass a value.

on the form load of my application i called: workerSample.RunWorkerAsync

Dim finalList As List(Of String)
Private Sub workerSample_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles workerSample.DoWork

[Code].....

View 1 Replies

Passing A Array As A Argument To A Javascript Function?

Apr 20, 2011

Im trying to pass a array as a argument to a Javascript function from code behind(vb.net)
Code im trying

[code].....

View 2 Replies

Passing Structure As Argument Through Files / Functions

Jun 21, 2012

I can't get to pass structure as argument through subs/functions in different files of single vbnet project like I use to in earlier MS basic versions.[code]File "mysetup.dat" is reachable and data is saved correctly what I can see with HxD.But read part seem's to not work as expected. Please any help on reliable passing structure as argument without too much public elements based on upper example.

View 1 Replies

VS 2008 - Passing Class As Argument For Function

Mar 23, 2010

VB.NET is not letting me dance with both feet, or piss with both hands. I've got one foot and one arm tied behind my back at every turn. I want to use this statement in a function:
Return CType(Formatter.Deserialize(FS), DS)
Seems doable, right?

Function ReadFileStream(ByRef FS As FileStream, ByRef DS As Object)
Dim Formatter As New BinaryFormatter
FS.Position = 0
Return CType(Formatter.Deserialize(FS), DS)
End Function

Right? I mean, CType only accepts a class name as the second argument. I can't give it an instance of a class, or it croaks. Yet if I try to pass the class name as the argument to that function:
DataInfo = ReadFileStream(FileStream1, DataStruct)

VB.NET croaks on this, too, complaining that "'DataStruct' is a type and cannot be used as an expression.". It's used as an expression by CType just fine outside of the function. Does the VB.NET legislature provide a clause that allows for a 'Type' to be passed as an argument in a function? Writing all the supporting code ten million times to deserialize a file using CType ten million times in a large application will get very complicated and tricky very quickly. It should be handled by a routine so that any cases and adjustments that come up can be dealt with in one spot.

View 8 Replies

When Passing An Object As An Argument To A Method, String Properties Are Populated But Integers Are Null

Jan 27, 2011

I have a class and method exposed to a client asp.net app. The class looks like

<DataContract()> _
Public Class Class1
Private v_string As String
Private v_integer As Integer

[code]....

The method is declared as

<OperationContract()> _
Function GetStuff(ByVal bar As Class1) As String

In the client code I create an instance of Class1 and set the values for v_string and v_integer, but using Wireshark to look at the xml being sent to the server only a value for v_string is being sent as part of Class1. I'm guessing this is because it considers the value of v_integer to be null/not set. Here is an example of the client code.

Dim MyService as New Service1.ServiceClient
Dim test as New Service1.Class1
test.P_integer = 1

[code]....

how different types are passed/used since Integer is a intergral type and String is a class, but can't seem to work out what to do to fix the problem.

View 4 Replies

.net - FileInfo Passing FileInfo Argument To Method?

Oct 12, 2011

I have the following VB function which takes a FileInfo object as a parameter:

Public Shared Shadows Sub Start(ByVal filePath As FieldInfo)
XmlConfigurator.ConfigureAndWatch(New System.IO.FileInfo(filePath.ToString()))
End Sub

In another class I have the following code calling that 'Start' method. But VisStudio indicates there is a problem with the 'FilePath' argument that I'm passing.

[Code]...

View 1 Replies

VS 2008 Make A Shell Replacement For The Windows Default Shell

Aug 1, 2009

I'm going to attempt to make a shell replacement for the Windows default shell: explorer.exe. I'm not sure if its possible using Vb.Net, but I can't seem why not. My end goal is to use a custom made shell for a Windows Preinstallation Environment instead of the default command prompt. I plan to use a 3rd party program to compile the program with the .NET Framework. Otherwise, it wouldn't work because Windows PE does not support the .NET Framework.

View 1 Replies

Sql Server - Assign The Value I Queried To A String Which Is An Argument In A Procedure If The Argument's Data Type Is An Object?

Dec 5, 2011

I made this procedure re-use a select query:

[code..]

And I use it like this if I would want the selected value placed in a textbox and it works fine

[code...]

However if I want the value to be passed in a string like so:

[code...]

The string ends up having an empty string value. How do I assign the value I queried to that String?

View 2 Replies

Use Shell To Have Application Call An External Application But Its Not Working - Error: 'System.windows.shell'

Jun 3, 2011

I'm trying to use the Shell to have my application call an external application but its not working...I don't understand why. I get the following error: 'System.windows.shell' is a namespace and cannot be used as an expression!

Heres my code....any ideas what I'm doing wrong. Its got to be a simple...stupid error.

Private Sub mnuUpgrade_Click(ByVal Ctrl As Microsoft.Expression.Web.Interop.Legacy.CommandBarButton, ByRef CancelDefault As Boolean) Handles mnuUpgrade.Click

[CODE].....................

View 2 Replies

Bat File To Run In Exe (like Shell)?

Apr 17, 2011

i have this

Quote:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Process.Start("mybatchfile.bat")
End Sub

its working if they are on the same folder,i want to do is make the batch file as a resource file so that i can run it even not in the batchs folder?

View 9 Replies

Launching A .lnk Using Shell

Jul 26, 2010

I can create a shortcut using this code:

Dim sFolder As String, sTarget As String, sAppName As String
Dim oShell As New WshShell
Dim oShortcut As WshShortcut

[Code]....

View 5 Replies

Regarding Unzip Using Shell Dll?

Apr 17, 2009

I am using Shell Dll to unzip zip file in vb.net 2005. Following is the code for this.

Dim sc As Shell32.Shell = New Shell32.Shell
Dim srcf As Shell32.Folder = sc.NameSpace(src)
Dim desf As Shell32.Folder = sc.NameSpace(des)

[code].....

View 2 Replies

Run Msg.exe After Opening A Shell Using Cmd.exe?

Jun 26, 2012

I want to send messages withing a windows 7 LAN using VB.NET code. The problem is that the msg.exe executes commands in admin mode only. Here is the code. Shell("cmd.exe /k runas /user:farook-pcadministrator msg.exe") 'Here i'm prompted for a password. Shell("cmd.exe /k msg.exe", 1) I use the /k switch to see what's going on in the shell. /c is the silent switch. I do not wish to use runas neither do I wish to change privilages in msg.exe

View 2 Replies

Run Shell() As Administrator?

Nov 14, 2009

I have an update app, which can be updated itself by another update app (so, the second app is an updater of the main updater). Both apps must have administrator permissions because of writing in the Program Files folder. Is it possible that when the main updater is running (under administrator rights) it can use Shell() to let the second updater run with administrator rights without a UAC confirm dialog popping up again?

View 3 Replies

Start Instead Of Shell?

Aug 10, 2010

it possible to have a start command instead of the simple shell the same code as in a .BAT File, i dont know but on a .bat is a higher/lower lvl.

[Code]...

View 11 Replies

Using Shell And Getting Feedback?

Oct 18, 2011

I want to be able to run any command by typing into a textbox.For example if I wanted to get info from "ipconfig".I want to be able to type "ipconfig" into the textbox and for it to then display the infomation into a richtextbox.I have been searching the internet but so far can not find a solution

Code:
Shell("ipconfig", AppWinStyle.Hide)

How do I now display the infomation from the console into a richtextbox?

View 3 Replies

Using Shell Function In .Net?

Dec 26, 2007

I want to use Shell function in Vb.Net.Thing is that i have 5 checkboxes. on checking each checkbox i want to execute batch file which fires some commands in database.but while checking all 5 checkboxes all batch file gets executed and then it gives me error.I want to run only one batch file at a time.

View 11 Replies

AccessViolationException With Shell To Explorer

Dec 15, 2010

I wrote a backup utility that synchronizes a list of folders. Errors appear in a list. In the list I can right-click to retry, exclude the folder next time, or open the folder in explorer to examine.When I shell to explorer I get an AccessViolationException. Form1 opens Form4 with Form4. ShowDialog(), and that's where the error occurs. The error does not occur within Form4 where the shell function is called. memory must be getting trashed somehow.I've used two methods, Shell and System.Diagnostics.Process.Start. Each produces similar results. Shell waits awhile before causing the error, but Process.Start causes the error immediately.This is VB.Net 2010 using framework 4, though I did resolve a shell problem once before with VBA by writing out a VBScript file then shelling to the VBScript file.

View 3 Replies

AccessViolationException With Shell To Explorer?

Dec 15, 2010

I wrote a backup utility that synchronizes a list of folders. Errors appear in a list. In the list I can right-click to retry, exclude the folder next time, or open the folder in explorer to examine.

When I shell to explorer I get an AccessViolationException. Form1 opens Form4 with Form4.ShowDialog(), and that's where the error occurs. The error does not occur within Form4 where the shell function is called. Memory must be getting trashed somehow.I've used two methods, Shell and System.Diagnostics.Process.Start. Each produces similar results. Shell waits awhile before causing the error, but Process.Start causes the error immediately.

This is VB.Net 2010 using framework 4, though I did resolve a shell problem once before with VBA by writing out a VBScript file then shelling to the VBScript file. I don't think the process being started is isolated enough. It's sharing memory or something else.

View 5 Replies

Add An Icon To Shell Handlers?

Apr 30, 2008

set the Icon for an item in a shell handler? I've set a contextmenu handler to the extension .savdata and added the text "Open with ConvertFile" to the handler so that the context menu for .savdata looks like this:

Open with ConvertFile
-------------------------------------
Send To >

[code]....

So how can I use "my.computer.registry.HKEY_CLASSES_ROOT" in VB 2008 express edition to add an Icon file path to the left of the context menu handler?

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved