- INDEX VB TO NET
- KNOWLEDGE BASE
- EWIS-WARNINGS
- WARNING #7005
WARNING #7005
Parameters (if any) must be set using the Arguments property of ProcessStartInfo
Description
This Warning appears when you are migrating a Shell call, and it means that the way that parameters are passed to a process in .Net is different than the VB6's.
Recommendations
If you need to pass parameters to a command being executed by a Shell, split the command and the arguments in this way:
ProcessStartInfo startInfo = newProcessStartInfo("command");
startInfo.Arguments = parameters;
Sample VB6
PublicSub ExcecuteCmd(ByVal parameters AsString)
Shell("command " & parameters, vbMaximizedFocus)
EndSub
Target VB.NET
PublicSub ExcecuteCmd(ByVal parameters AsString)
'UPGRADE_WARNING: (7005) parameters (if any) must be set using the Arguments property of ProcessStartInfo
Dim startInfo As ProcessStartInfo = New ProcessStartInfo("command " & parameters)
startInfo.WindowStyle = ProcessWindowStyle.Maximized
Process.Start(startInfo)
EndSub
Target C#
publicvoid ExcecuteCmd( string parameters)
{
//UPGRADE_WARNING: (7005) parameters (if any) must be set using the Arguments property of ProcessStartInfo
ProcessStartInfo startInfo = newProcessStartInfo("command " + parameters);
startInfo.WindowStyle = ProcessWindowStyle.Maximized;
Process.Start(startInfo);
}