|
No, I haven't. I don't even use the Help class. And from the OP's description, it didn't look like he was either. It looked more like a description of a problem with showing a normal window.
|
|
|
|
|
I have this program below when i click this the text in textbox1 should replace the value of x
as a command line variable but this isn't happening.
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim x As String
x = TextBox1.Text
Shell("un.cmd x", AppWinStyle.NormalFocus, False)
End Sub
Any help would be great.
please respond asap.
thanks.
|
|
|
|
|
Try this:
Shell("un.cmd " & x, AppWinStyle.NormalFocus, False)
|
|
|
|
|
I says "file not found" while debugging, and crashes.
|
|
|
|
|
Sorry,
I first wrote this:
Shell("un.cmd" & x, AppWinStyle.NormalFocus, False)
Then edited my comment to this (with a space after un.cmd ):
Shell("un.cmd " & x, AppWinStyle.NormalFocus, False)
Try the one with the space.
You were putting your variable in your code as a string, not the variable name.
|
|
|
|
|
Thanks that worked but when my variable i.e text in the textbox1 contains spaces only first word is shown.
this is what i want to actually do.
@echo off
7zr a -mx9 "%1".7z "%1".ecm
pause
this is a batch program to create archives of any file give as first argument to it.
now what i want to do is that i want do the same using vb so that i don't need an extra batch program.
Can you please tell me how to doing by replacing the varibles %1 as variable x
something like this
dim x as string
x = textbox1.text
shell("7zr a -mx9 "x".7z "x".ecm")
thanks.
|
|
|
|
|
If your file name has spaces in it, I believe you have to surround the filename with double quotes. You'd want something like this:
Shell("7zr a -mx9 " & """" & x & ".7z" & """" & " " & """" & x & ".ecm")
|
|
|
|
|
Thank you very much it worked.
|
|
|
|
|
can you please explain how it was done.
Thanks.
|
|
|
|
|
Shell("7zr a -mx9 " & """" & x & ".7z" & """" & " " & """" & x & ".ecm")
"7zr a -mx9 " is the call to your program, the space after the 9 is to get ready for the first parm.
& """" concats a double quote
& x concats your variable file name
& ".7z" concats the extension
& """" concats a double quote
& " " concats a space to get ready for the next parm
& """" concats a double quote
& x concats your variable file name
& ".ecm" concats the extension
So...looks like I forgot to put the last quote in... you need one more of these:
& """" for the last double quote.
When your x variable is set to My File ...this would be the output:
7zr a -mx9 "My File.7z" "My File.ecm"
|
|
|
|
|
thanks Now i Figured it out.
|
|
|
|
|
The Shell statement is deprectated and is only there for backward compatibility of upgraded VB6 code. Use the Process class instead.
|
|
|
|
|
Do you mean diagnostics.process.start ?
But that doesn't wait for process to finish.
|
|
|
|
|
Striker.dbz wrote: that doesn't wait for process to finish
That must have been an excellent reason for coming up with an entire class; lots of useful methods are available.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Did you bother to read the documentation on the Process class or even look through the Intellisense list after you typed Process. ?? Maybe that WaitForExit method might be useful for something...
|
|
|
|
|
Can you please elaborate i am very new to programming?
Thanks.
modified on Thursday, June 4, 2009 3:03 AM
|
|
|
|
|
Process.Start just starts a process; just as Shell does. However, it returns a Process instance. If you call WaitForExit on this Process instance, your main application's thread will block until the process closes
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Is it something like this
dim x as an integer
x = Process.start("program.exe")
call Waitforexit(x)
Please reply asap.
|
|
|
|
|
No, something like this:
Dim p As Process = Process.Start(...)
p.WaitForExit()
You can also pass an additional parameter to WaitForExit which specifies a timeout period - useful if your application is waiting for a process to finish, but cannot finish for some reason
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
Thanks.
Now i have another problem.sorry.
I have delete a file in a directory
but only if the file exists
i am trying to use mycomputer.getfiles.method but don't no how to do it.
Please reply.
|
|
|
|
|
If(File.Exists("FilePath"))<br />
File.Delete("FilePath")<br />
End If
You may want to look into the System.IO namespace - in particular the File, Path, Directory, DriveInfo, FileInfo and DirectoryInfo classes
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
it says file isn't declared.
Help!
|
|
|
|
|
You may want to make a new topic for completely unrelated topics. And chances are that you need to add an Imports System.IO at the top of your code file
Between the idea
And the reality
Between the motion
And the act
Falls the Shadow
|
|
|
|
|
ya i got it now
All problems solved.
Thanks so much to every one for helping me.
|
|
|
|
|
i have got a source code file (classlibrar style), which has successfully been impiled to a DLL file.
so how can i load this dll file in my .net vb project? i want details ,thank you!
|
|
|
|