|
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!
|
|
|
|
|
1. Add the file to your project:
In the solution explorer,
right Click on your project,
select add --> existing item.
Find the dll file and add it.
2. Add a reference to the dll
in the solution explorer,
double click on My Project,
select the references tab.
click add.
select the browse tab
Find the dll file and click ok
|
|
|
|
|
Thank you,i got it.but how can i declare function to use a function in DLL ?
|
|
|
|
|
Once the dll has been referenced, you need to create an instance of it and then you can call any exposed methods or functions it conatins. For example, if your DLL is named MyLibrary and has a function called MyFunction that takes two string parameters. This is how you would call it and use it:
Dim objLib as New MyLibrary<br />
Dim str as String<br />
str = objLib.MyFunction("Hello", "World")
|
|
|
|
|
Hi guys,
I'm working in VBexpress2008 using the sql server compact that comes with it. I'm trying to delete a row from a listbox out of a table using this code:
Private Sub Deleteip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Deleteip.Click
DataSet.IP.Rows(IPlistbox.SelectedIndex).Delete()
DataSet.IP.AcceptChanges()
IPTableAdapter.Update(DataSet.IP)
End Sub
it all seems to work fine, deleteing it from the dataset, no errors when running the tableadapter.update but when i go back into it they are there again!
any suggestions would be appreciated, thanks
Chris
|
|
|
|
|
A possible answer might be that when you re-run the code it is copying the database from the original into the bin\debug folder.
This happens when you run in debug so that the testing does not trash the original database.
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Does your table adapter have a delete statement defined within the dataset?
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
The problem is that you called AcceptChanges before you called Update. This tells the DataSet that the modifications that it is holding should now be considered synced up with the database. now that you've essentially wiped out all the changes, when you call Upgdate, the DataAdpater doesn't see any changes to make to the backing database, so nothing changes. When you go run your code again, you see the database exactly how it was when you ran it the last time.
|
|
|
|
|
doh! Yuppers!
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Wow thanks for the reponse. I think I was going wrong as I was under the impresion that when you mark the row for deletion the acceptchanges removes it from the dataset then the update syncsthe source with the dataset. now I know! and yes, the tableadapter doesn't have a valid delete command.
thanks alot!
chris
|
|
|
|
|
Tha'ts why we have documentation on nearly every class, method and property in the .NET Framework. Just looking at a method name and trying to guess at what it does isn't doing you any favors.
|
|
|
|
|
very true, but that was the impression I got from the documentation! Oh well, still very new to this. Here's how I fixed it for peoples reference:
Private Sub Deleteip_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Deleteip.Click
Dim item, port As Integer
Dim ip As String
item = IPlistbox.SelectedIndex
ip = DataSet.IP.Item(item).IPaddress
port = DataSet.IP.Item(item).Port
DataSet.IP.Rows(IPlistbox.SelectedIndex).Delete()
DataSet.IP.AcceptChanges()
IPTableAdapter.DeleteQuery(ip, port)
End Sub
|
|
|
|
|
Hi,
In am doing the simultaneouly two imports. Which export the data from excel to sql server.
There are some common tables, which are being approached by both these imports. and results in deadlock
Transaction (Process ID 53) was deadlocked on resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
In the sql profiler, i have seen that a couple of queries are taking time, which are using common tables in imports. I have optimized it also.
Can you provide me any suggestion?
Thanks
|
|
|
|
|
Um...Don't do the imports simultaneously?
Do some kind of check to make sure the files not being used by another process before doing the import.
|
|
|
|
|
This would tell me that you can't do the imports simultaneously since they both add/modify to the same table(s).
You don't have a choice but to do them sequentially.
|
|
|
|