|
cstrader232 wrote: Is it possible to copy the data in a DataGridView column into an array without using a loop?
No. You have no choice but to enumerate the cells you need from wherever the data is being kept and copy them to any array.
|
|
|
|
|
I have to execute an application (ie: c:\applications\task1.exe). I have to send some different commands and wait for the responses. Some responses are fast and has only few lines, some will take long time to execute but response every second with a dot until it completed
I would line to send command line through VB environment (might be with Shell (...) command?), but able to capture the responses without waiting it completed (to monitor its processes)
Anyone can show me how to do it?
Many thanks
|
|
|
|
|
There's a bunch of code behind that. But, you're launching the process with the Process class, then redirecting the StandardInput and StandardOutput streams so your code can capture the output of the console app.
I don't have an example handy because I'm walking out the door right now...
|
|
|
|
|
ATC wrote: I have to execute an application (ie: c:\applications\task1.exe). I have to send some different commands and wait for the responses. Some responses are fast and has only few lines, some will take long time to execute but response every second with a dot until it completed
I would line to send command line through VB environment (might be with Shell (...) command?), but able to capture the responses without waiting it completed (to monitor its processes)
Anyone can show me how to do it?
Here is an example, which executes the "cmd.exe" (command line executable), gets a directory listing, and displays the result in a messagebox:
Dim ps1 As New Process
ps1.StartInfo.FileName = "cmd.exe"
ps1.StartInfo.WindowStyle = ProcessWindowStyle.Normal
ps1.StartInfo.CreateNoWindow = False
ps1.StartInfo.UseShellExecute = False
ps1.StartInfo.RedirectStandardOutput = True
ps1.StartInfo.RedirectStandardInput = True
ps1.Start()
Dim s As String
Dim sIn As StreamWriter = ps1.StandardInput
Dim sOut As StreamReader = ps1.StandardOutput
sIn.AutoFlush = True
sIn.Write("dir /p" & System.Environment.NewLine)
s = sOut.ReadToEnd()
MessageBox.Show(s)
Don't forget to "Imports System.IO" for this. I hope this helps.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Thanks, I also hope so, but I got errors on Dim sIn As StreamWriter (not defined). might be I need add some kind of Import?
|
|
|
|
|
ATC wrote: Thanks, I also hope so, but I got errors on Dim sIn As StreamWriter (not defined). might be I need add some kind of Import?
Correct. At the very "TOP" of your Windows Form, type "Imports System.IO". That should fix your problem.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi Pete,
Thanks for the reply, however when I try to run as it is (without compiling error), it launches cmd (ms-dos window) empty then stays there forever until I close the ms-dos window then it shows the responses ( MessageBox.Show(s) )
I do not know why I have to close the ms-dos window manually, can we close it automatically?
Thanks
-- modified at 10:29 Tuesday 16th October, 2007
|
|
|
|
|
ATC wrote: Thanks for the reply, however when I try to run as it is (without compiling error), it launches cmd (ms-dos window) empty then stays there forever until I close the ms-dos window then it shows the responses ( MessageBox.Show(s) )
I do not know why I have to close the ms-dos window manually, can we close it automatically?
Its because of this statement:
s = sOut.ReadToEnd()
Take that line out and it will close the DOS screen on its own.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Oopps, in that case how can I read the return from the application?
|
|
|
|
|
i made a c++ project long back.
now i am learning dot net..
i want to add an interface now on vb.net..
but i dont know how to add .cpp file in vb.net
can anybody help.?
|
|
|
|
|
manni_n wrote: i made a c++ project long back.
now i am learning dot net..
i want to add an interface now on vb.net..
but i dont know how to add .cpp file in vb.net
can anybody help.?
What you can do is to either compile the C++ project into a DLL and add a reference to it in VB.NET, or you can convert your C++ project to VC++ .NET project and add a reference to the whole project.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com
|
|
|
|
|
Hi,
I made my download manager in VB.Net but I don't konw how to set it as default for IE 6 and also for IE7 ?
Any idaes?
Thanks,
Dan
|
|
|
|
|
There is no Download Manager in IE, so no way to set one.
|
|
|
|
|
I think I need to explain more. I have created the download manager like flashget,freedownloadmanager,Getright and the other ones... They all have the option to set them in ie as default so when a download begins the ie show thier interface instead of its' orignal.I want to do same thing.
|
|
|
|
|
I don't know how it does it, but IE doesn't have this "option". Maybe if it was written as a AddOn to IE you get this ability. I can't tell you because I've never written anything for IE.
|
|
|
|
|
Hi,
Yes IE doesn't have any options but we can do it using some registry help.I think I found the perfect answer from this link : http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2154635&SiteID=1
Thanks,
Dan
|
|
|
|
|
Hmmm... I never knew about that one.
|
|
|
|
|
Oh .. Never mind
|
|
|
|
|
Hi:
I have a problem, i'm programming under vb.net 2005 express edition, i have a main window with some panels with controls over they, well, i have a track control who is scroll to change the window opacity, i was this method in another programs and the window change the opacity without problems, but in this program my windows is darkness when i change the opacity value, only first time, why?.
The track control is over slipt panel but i need this panel to what the user change the meters of panel, could be the problem reason?, if yes what could im made?, thanks very much for your help
|
|
|
|
|
Hi haggenx,
I also have the same problem . Sometimes it runs ok & sometimes it shows the Darkness. I think it may be because of Graphic card or.. ??
Thanks,
Dan
|
|
|
|
|
oops, and not exist a method to cancel this problem? , well, thanks very much for your help.
|
|
|
|
|
Hi,
Yes I'm still looking for the answer and whenever I will get it I will post it here
Dan
|
|
|
|
|
well, thanks for your help
|
|
|
|
|
I have an XmlDocument (System.Xml) that i want to add to and do various other stuff but i want to split the routines down. I've read that ByVal is 'safer' to use and possibly quicker than byref so i am proposing to layout my functions as below...
Imports System.Xml
'Declaration
Dim XmlDocObject as New XmlDocument
XmnlDocObject = InitialiseXml(XmlDocObject)
Private Function InitialiseXml(ByVal v_XmlDocObject as XmlDocument) as XmlDocument
'Temp object
Dim TempXmlObject = v_xmlDocObject
'Do something with temp object......
'Return object now processing is finished
Return TempXmlObject
'Destroy temp object
TempXmlObject = Nothing
End Function
What i would like to know is if the above is good / bad practice?
Anything thing wrong with this way?
Is this the preferred way as opposed to using Byref or am i creating extra objects which will
lie around in memory (until GC see fit to get rid)?
Regards
|
|
|
|
|
Your code is incorrectly written so it really doesn't matter which one you use. What you've done is definitely bad practice. No, ByVal is not "safer", nor is it "quicker". The two are used for different reasons.
The way you're writing your code, you're writing a function that returns an XmlDocument, the one that's passed in, and you don't have to.
Since you're passing in a Reference type (any class instance), ByVal passes the reference to the object, not the object itself. Passing in an object ByRef passes in a reference to the reference of the object, which doesn't really give you anything. So, since your function is getting a reference to the object on the heap, it can modify that object and not return anything.
Dim XmlDocObject As New XmlDocument
InitializeXml(XmlDocObject)
Private Sub InitializeXml(ByVal xmlDocument As XmlDocument)
' Do whatever you need to do to "xmlDocument"
' Do not "return" anything since you're modifying
' the original object.
End Sub
|
|
|
|