Dim e As String = "" Dim ps As System.Diagnostics.Process For Each ps In System.Diagnostics.Process.GetProcesses bl.Items.Add(ps.ToString) Next For Each item In bl.Items MsgBox(e = e + item.ToString) Next
16 Replies - 768 Views - Last Post: 06 May 2009 - 11:17 PM
#1
Why does this happen?
Posted 03 May 2009 - 12:35 PM
why does my code give me the answer of false? when I do have process running??? 
Replies To: Why does this happen?
#3
Re: Why does this happen?
Posted 03 May 2009 - 05:08 PM
This looks a lot like like a homework question.
Explain what you want to accomplish with your routine please
Explain what you want to accomplish with your routine please
#4
Re: Why does this happen?
Posted 04 May 2009 - 06:07 AM
specialfreckles, on 3 May, 2009 - 04:08 PM, said:
This looks a lot like like a homework question.
Explain what you want to accomplish with your routine please
Explain what you want to accomplish with your routine please
its not a homework question
#6
Re: Why does this happen?
Posted 06 May 2009 - 09:05 AM
@Asscott: From that code I cant see where it should return true or false (maybe I haven't had enough coffee lol)
#7
Re: Why does this happen?
Posted 06 May 2009 - 10:35 AM
you may want ps.Id or ps.ProcessName instead of ps.ToString to get the details you want.
the msgbox is showing False because you are asking it to show if e is equal to e concatentated with item.ToString - and they are not equal hence false. You likely want MsgBox("e = " & e & item.ToString)
the msgbox is showing False because you are asking it to show if e is equal to e concatentated with item.ToString - and they are not equal hence false. You likely want MsgBox("e = " & e & item.ToString)
#8
Re: Why does this happen?
Posted 06 May 2009 - 12:34 PM
mark.bottomley, on 6 May, 2009 - 09:35 AM, said:
you may want ps.Id or ps.ProcessName instead of ps.ToString to get the details you want.
the msgbox is showing False because you are asking it to show if e is equal to e concatentated with item.ToString - and they are not equal hence false. You likely want MsgBox("e = " & e & item.ToString)
the msgbox is showing False because you are asking it to show if e is equal to e concatentated with item.ToString - and they are not equal hence false. You likely want MsgBox("e = " & e & item.ToString)
thanks mark erm but how do I get rid of the other stuff because at the moment its coming up with e = {systems.diagnostics.process(VSHhost)} ? i would prefer just e = VSHHost
#9
Re: Why does this happen?
Posted 06 May 2009 - 12:48 PM
Need 2 things - what type of control is "bl" and what selector are you using with ps - ProcessName? Then I will replicate and see.
#10
Re: Why does this happen?
Posted 06 May 2009 - 01:00 PM
mark.bottomley, on 6 May, 2009 - 11:48 AM, said:
Need 2 things - what type of control is "bl" and what selector are you using with ps - ProcessName? Then I will replicate and see.
Friend WithEvents bl As New ListView
and i dont know what you mean by selector all im using is this - Dim ps As System.Diagnostics.Process
#11
Re: Why does this happen?
Posted 06 May 2009 - 01:24 PM
by selector - I mean when you add the ps data to items, what do you use.
bl.Items.Add(ps.ToString)
is in your original sample - i.e. you were using ToString as the selector on ps - are you still using it or something else?
bl.Items.Add(ps.ToString)
is in your original sample - i.e. you were using ToString as the selector on ps - are you still using it or something else?
#12
Re: Why does this happen?
Posted 06 May 2009 - 01:34 PM
#13
Re: Why does this happen?
Posted 06 May 2009 - 01:38 PM
you may have garbage in the e string - try MsgBox("e =" & item.ToString)
you can enable sorting on the listview to get the stuff back in an easy to compare order also.
you can enable sorting on the listview to get the stuff back in an easy to compare order also.
#14
Re: Why does this happen?
Posted 06 May 2009 - 01:43 PM
Im not sure what youre e is for, but I tried this and it worked:
Dim ps As System.Diagnostics.Process
For Each ps In System.Diagnostics.Process.GetProcesses
bl.Items.Add(ps.ProcessName.ToString)
Next
Dim e1 As String = ""
For Each item As ListViewItem In bl.Items
MsgBox("e1 = " & item.Text.ToString)
Next
This post has been edited by sh250080: 06 May 2009 - 01:44 PM
#15
Re: Why does this happen?
Posted 06 May 2009 - 01:54 PM
it was your e from the original code - I don't know what you had it for 
Anyways - success?!
Anyways - success?!
|
|

New Topic/Question
Reply




MultiQuote






|