Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

First of all, please repost the code without line numbers. It screws up the formatting. Also, a suggestion to simplify your code. Create the nine digit buttons and name them btn0, btn1, etc. Create a button click handler for one button then modify it as follows:

Private Sub btn0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn0.Click, btn1.Click, btn2.Click, btn3.Click, btn4.Click, btn5.Click, btn6.Click, btn7.Click, btn8.Click, btn9.Click
    Dim button As Windows.Forms.Button = sender
    txtTimer.AppendText(button.Text)
End Sub

That way you can use one handler to handle all 10 buttons. The above code is pretty simple minded. You might, for example, split the numeric display into two separate controls with a label ":" to separate them. The left control would be for minutes and the right for seconds. You could also add code that disables certain buttone (like "Cook" or "Start") if the entered time is not valid (eg 23:97).

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's exactly how it is done. The items are added as follows:

item = New ListViewItem          'create new listview item

item.Text = col1text             'add column 1
item.SubItems.Add(col2text)      'add column 2
item.SubItems.Add(col2text)      'add column 3

listView.Items.Add(item)         'add item to listview
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In the original solution I posted, the copy code looked like

Dim srce = My.Computer.FileSystem.CombinePath(txtSrce.Text, sheet.Cells(row, 1).value)
Dim dest = My.Computer.FileSystem.CombinePath(txtDest.Text, sheet.Cells(row, 1).value)

That code uses the same base filename (from column 1) for both the srce and dest file names. If you want to specify a different dest file name from column two just use 2 for the index in the second line as

Dim srce = My.Computer.FileSystem.CombinePath(txtSrce.Text, sheet.Cells(row, 1).value)
Dim dest = My.Computer.FileSystem.CombinePath(txtDest.Text, sheet.Cells(row, 2).value)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Isn't that just what I said three days ago?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's not a mouse event. it's a buttonClick event and the ControlDown method doesn't apply there. I tried the following:

def OnButtonClick(self,event):
        
        #get the name of the image set from the button

        self.Curr = event.EventObject
        
        #hide the previous set
        
        if not event.ControlDown() and self.Prev != None and self.Prev != self.Curr:
            #print "hide",self.Prev.GetName()
            self.HideFiles(self.Prev)
            self.Prev = None
            
        if self.Curr.Show:
            #print "HIDE",self.Curr.GetName()
            self.HideFiles(self.Curr)
            self.Curr = None
        else:
            #print "SHOW",self.Curr.GetName()
            self.ShowFiles(self.Curr)
            self.Prev = self.Curr

        self.RefreshViewer()
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I have an app I wrote in Python/wxPython. When I click a button, the action that is taken will depend on whether or not a modifier key (such as CTRL) is currently pressed. I can't toggle a swich based on a keypress event (eg ctrldown = True or False) because the form may not have focus continuously. Ideally, the button click code should be something like

if ctrldown:
    #ctrl key is pressed - do one action
else:
    #ctlr key is not pressed - do something else

Is there any way of checking the current status of the keys like CTRL, SHIFT, ALT, etc?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's what I thought except when I do WINKEY-1 or WINKEY-2, neither of the pinned items starts. Just noticed another strange thing. I never used to have to log in to DaniWeb on every visit. My session was "remembered" through a cookie. Now I have to log in every time. Hmmmm..

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Well, this is embarrassing. I had to completely rebuild my laptop from scratch. I usually keep 3 or 4 items pinned to the taskbar and launch them with WINKEY-1, WINKEY-2, etc but somehow or other this no longer works. I really should know how to do this but I just cannot remember how to enable the WINKEY-# hotkey for the taskbar. Anbyone out there recall how? That's the trouble with restoring from images. You forget how to do the basic stuff.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Why not just use the screensaver settings to lock the computer after a specified period of inactivity?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you display all of the info you want as the command prompt you won't have any space left to type a command.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

set prompt=$V

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can create a shortcut using the following vbScript code. You can also code this into VB.

set wso = CreateObject("Wscript.Shell")
folder = wso.SpecialFolders("StartMenu")

set shortcut = wso.CreateShortcut(folder & "\myconfig.lnk")
shortcut.TargetPath = "\\networkaddress\tablet config.exe"
shortcut.Arguments = ""
shortcut.Description = "tooltip descriptive text"
shortcut.WorkingDirectory = "\\networkaddress\tablet config.exe"
shortcut.Save

If you want to copy the exe to a local folder then change the value of shortcut.TargetPath and shortcut.WorkingDirectory. There are other values that you can use for SpecialFolders such as

AllUsersDesktop
AllUsersStartMenu
AllUsersPrograms
AllUsersStartup
Desktop
Favorites
Fonts
MyDocuments
NetHood
PrintHood
Programs
Recent
SendTo
StartMenu
Startup
Templates

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

First of all, you shouldn't copy actual executables to that location. If you have a look you will see that it has "lnk" files there which are shortcuts to the actual executable files. So for starters you could create just a shortcut there and put the executable anywhere. If the users will always be connected to the network then the shortcut could be created to point to the network location.

More later - I have to go look at show-homes.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I'm no great fan of C++ but rather than awaiting the death of C++ I would much rather see the demise of programmers who write butt-ugly code regardless of the language. My elder son recently completed his PhD in computational bio-physics and I perused a lot of C++ code over the last four years. No white space, little documentation and almost no comments - at least that was the case when he inherited the code base that he enhanced. I know it is possible to write undecipherable code in any language but some languages (like C++) seem to encourage it.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I would differ with that only slightly. Your pseudo-code has a test at the top AND bottom of the loop. I would rewrite it as

start with an empty array
while the length of the array is less than 6
    generate a random number
    if that number is not in the array
        add it to the array
    end if
end while
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you have already covered arrays then I suggest you use an array to hold the random numbers. You start with no random numbers in the array. Your outer loop will terminate when you have generated the 6 required unique numbers. Inside the loop you can generate a random number and add it to the array only if it isn't already present in the array.

Does that make it a little clearer?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

A better way to generate non-repeating random sequences (for example, dealing cards from a deck) is to start with your array, Amount, then generate a random integer from 0 to last (where last is initially set to Ubound(Amount). When you generate your first random index (let's call it rind), adjust your Amount array as follows:

Amount(rind) = Amount(last)
last -= 1

That guarantees that you never get the same "amount" twice.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If the quantity for discount varies from item to item then I suggest you add it as well as the discount to your listview as a subitem. That way you wouldn't have to hardcode a test for each type of item. Also, your insert query is independent of the item type and discount so you can remove all the inserts from inside the selects and just do one insert after you have determined the discount.

'get item price and minimum limit needed for discount

price = CDbl(ListView1.FocusedItem.SubItems(3).Text)
limit = CInt(ListView1.FocusedItem.SubItems(?).Text)
quantity = CInt(ListView1.FocusedItem.SubItems(2).Text)
discount = CDbl(ListView1.FocusedItem.SubItems(?).Text

'determine price with possible discount

If quantity > limit Then
    total = FormatCurrency(quantity * price * discount,2)
Else
    total = FormatCurrency(quantity * price,2)
End If

'update database

execute("insert...")
FillListview(execute("select * from tblOrder"), ListView2)
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

If you do My.Computer.FileSystem.CopyFile(srce,dest,True), the "True" parameter says overwrite the file if it already exists in dest.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In what way is it not working?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My pleasure. Only you or a moderator can mark this thread as solved.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can check if the file exists just before the copy using something like

if My.Computer.FileSystem.FileExists(srce) Then
    My.Computer.FileSystem.CopyFile(srce, dest)
Else
    'log the event to the txtLog box or pop up a MsgBox
    'or do something else to indicate a skipped file
End If

Or you could put the file copy in a Try/Catch block. That would also catch any other errors that might crop up during the copy like access rights violations, or trying to copy over a write protected file.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

That's why I included the picture of the for - so you could rebuild it step by step. Build a new form and name the controls based on the source code. You can open the main vb file in notepad or whatever then copy each block of code in to the VB 2008 form. I suggest you not just copy the entire text in. Rather (for example), double click on each button in the form, then copy the body of each block of code (ie everything between but not including "Private Sub..." and "End Sub") into the vb 2008 code page. Just make sure you name the controls properly.

I'll be online all day in case you need more.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I hope we all had a good night's sleep. I started from scratch. I am using Visual Studio 2010 but you should be able to use what I have. First of all, start a completely new project. Don't keep anything from your current project. I'm not implying that everything you did was wrong, it's just that when I used your project things went south due to funny settings, or possibly bad references. I've attached a zip file containing my new project. One of the files is mainform.jpg which will show you what my project form looks like. Using this plus the code you should be able to rebuild. The only reference you should have to add is the "Microsoft Excel 11.0 Object Library" or whatever version is on your system. Having said that, here is the code:

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'get the last saved settings

        btnCopy.Enabled = False

        txtExcel.Text = My.Settings.ExcelFile
        txtSrce.Text = My.Settings.SourceFolder
        txtDest.Text = My.Settings.DestinationFolder

        SetCopyButtonText()

    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click

        'save the user entered values for the next session

        My.Settings.ExcelFile = txtExcel.Text
        My.Settings.SourceFolder = txtSrce.Text
        My.Settings.DestinationFolder = txtDest.Text

    End Sub

    Private Sub btnExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExcel.Click

        'browse for an Excel file containing the list of files to copy

        OpenFileDialog1.Title = "Select an Excel File"

        If txtExcel.Text <> "" Then
            OpenFileDialog1.InitialDirectory = My.Computer.FileSystem.GetParentPath(txtExcel.Text)
        End If

        OpenFileDialog1.Filter …
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

In that case I don't think I can help because I don't understand the problem. I'm strictly an English type person.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's 11:00 PM here at the moment. I'll have a look in the morning.

Happy to help.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

First of all, your application is a form with some controls and not a single scrap of information on that form that indicates what the user is supposed to do with it, or any context as to what the controls do. Browse? Browse for what. You mention some interaction with an Excel file but you didn't provide one for me to look at. Your code has zero comments as to what it is supposed to do. If I don't know what the code is supposed to do I can't tell when it isn't doing it.

Give me some help here and I'll do the same.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

"String" isn't a class. It's a data type like Integer. Using the cust class that we defined above, we declare a variable that can hold an instance of the class as follows:

Dim mycust as cust

This does not create an instance of the class cust. It declares a variable that can hold a reference to (address of) an instance of cust. However, when you then say

mycust = New cust

the New keyword creates an instance of cust and places the address of it into mycust. Now you can use mycust to get at the properties and methods defined in cust. You could do the above two steps in one step by

Dim mycust as New cust

But when you do

Dim mystring as String

You do not have to use the New keyword before doing

mystring = "splunge"

That is the main difference between a class and a primitive data type. Now back to your example. Since you only want to store a string literal, why are you so determined to create a string-like class? What is it that you want to do that you cannot do with a string variable?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I thought you had that part figured out. If you define the source and destination folders in My.Setting variables then you can do

'get the source and destination folder names

srceFolder = My.Settings.SourceFolder
destFolder = My.Settings.DestinationFolder

'then inside the loop you compose the full path and file names

srce = srceFolder & sheet.Cells(row,1)
dest = destFolder & sheet.Cells(row,1)

objFSO.CopyFile srce,dest

A couple of potential gotchas. When you get the values of srceFolder and destFolder from Settings, make sure they end with "\". If they don't then add it. Also, you don't have to specify a file name for the destination. If it ends with "\" then the CopyFile will assume the destination is a folder and copy the file to there with the same file name as the source file.

It's up to you to do error checking to make sure the file copy succeeds and to handle any potential errors like insufficient access rights.

Have you considered that putting the source and destination folder names in the application setting makes it more difficult to modify later if you change folders?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can restrict yourself to the first sheet by

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim xls As New Excel.Application
        Dim folder As String = "D:\myfolder\"
        Dim sheet As Excel.Worksheet

        xls.Workbooks.Open("d:\my documents\points-jim.xls")
        sheet = xls.Workbooks(1).Worksheets(1)

        Debug.WriteLine(sheet.Name)

        Dim row As Integer = 1

        Do Until sheet.Cells(row, 1) Is Nothing
            If Len(Trim(sheet.Cells(row, 1).value)) > 0 Then
                Debug.WriteLine(folder & sheet.Cells(row, 1).value)
            End If
            row += 1
        Loop

    End Sub

End Class

Is there anything more you need help with?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The following code is slightly modified from an example I just posted for another user. It should give you an idea on how to adapt it for what you want. If you need it to be more specific just let me know.

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim xls As New Excel.Application
        Dim folder As String = "D:\myfolder\"

        xls.Workbooks.Open("d:\my documents\points-jim.xls")

        For Each sheet As Excel.Worksheet In xls.ActiveWorkbook.Worksheets

            Debug.WriteLine(sheet.Name)

            Dim row As Integer = 1

            Do Until sheet.Cells(row, 1) Is Nothing
                If Len(Trim(sheet.Cells(row, 1).value)) > 0 Then
                    Debug.WriteLine(folder & sheet.Cells(row, 1).value)
                End If
                row += 1
            Loop

        Next

    End Sub

End Class
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You don't need a class for that. If you declare mystr as above then you can just do

mystr = "some string"

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

The following code scans the first 500 rows and 20 columns of all worksheets and writes the values of all cells that start with the letter "c".

Imports Excel = Microsoft.Office.Interop.Excel

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim xls As New Excel.Application
        Dim cell As String

        xls.Workbooks.Open("d:\my documents\points-jim.xls")

        For Each sheet As Excel.Worksheet In xls.ActiveWorkbook.Worksheets

            Debug.WriteLine(sheet.Name)

            For row As Integer = 1 To 500
                For col As Integer = 1 To 20
                    cell = sheet.Cells(row, col).value
                    If (Not cell Is Nothing) AndAlso cell.StartsWith("c") Then
                        Debug.WriteLine(cell)
                    End If
                Next
            Next

        Next

    End Sub

End Class
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I believe you can only reference cells by column and row number in vb or vbScript, not by "A", or "B".

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

You can't use the class name as a variable. You have to declare the class as follows:

Public Class cust

    Private m_inputstr As String

    Public Property inputstr() As String
        Get
            Return m_inputstr
        End Get
        Set(ByVal value As String)
            m_inputstr = value
        End Set
    End Property

End Class

Then you can use it as follows:

Dim test As New cust
test.inputstr = "splunge"
Debug.WriteLine(test.inputstr)

At least that is how I would do it. I'm still not that well versed in the finer points of OOP.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I just tried a quick test. I opened Explorer and tried to browse to c:\Windows\Temp. I was prompted with a pop-up that said "You don't currently have permission to access this folder. Click Continue to permanently get access to this folder."

I then created an Explorer shortcut and ran it as Administrator. I got the same pop-up so it appears Admin rights are not sufficient as you pointed out. However, it seems that either with those rights Windows is still willing to give access.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Well that explains it then.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

My point is that with your method YOU MUST CLICK YES to run the app. With my method you don't have to click anything which is what I believe the OP wanted.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

All that does is define the right that the program requires when run. It still results in the UAC pop-up when he tries to run the program. I modified one of my existing vb apps as you said and I was prompted with the UAC pop-up. The method I suggested above is a little awkward to set up but it results in a cleaner (no pop-up) start.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

But if you run the explorer-like app using the method in my link then it will run the access rights sufficient to access all folders. The alternative is to pin the app to your taskbar then CTRL-Shift click. This will pop up the UAC dialog which will give you the same rights as the task scheduler/schtasks workaround.

I don't see the problem.

I have an application (Songbird media player) that for whatever reason needs to save a setting in a restricted folder. I've mentioned this to the developers but the "bug" remains. Every time I run Songbird it pops up the UAC. Really annoying. I created a task scheduler entry named "songbird" and I specified that it should run with highest rights. I created a shortcut with

schtasks /run /tn "songbird"

as the target. Now when I run the shortcut, Songbird starts without the UAC nonsense. Of course it is very important that you trust the program that you are giving these access rights to. Songbird is open source and I have checked out the source code. You are rolling your own app so unless your app does something really bad (due to a bug) then I don't see a problem.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Use the "Expand" method as in trvMyTree.Nodes(0).Expand

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I believe the actual algorithm is Newton's method. You start with a guess as to the answer then iterate through a formula to get the next approximation. Repeat as needed. It converges very quickly to the answer.

Example - find the square root of 10. Let's guess that it is 2 (it's not a good guess but it doesn't matter). To find the next approximation we divide the original number by our guess, add it to our guess then divide the result by 2.

(2 + 10/2) / 2 = 3.5
3.5 squared is 12.25

(3.5 + 10/3.5) / 2 = 3.178571429
3.178571429 squared is 10.10331633

(3.178571429 + 10/3.178571429) / 2 = 3.162319422
3.162319422 squared is 10.00026413

etc. Each iteration gets us closer to the actual square root. All of it requires floating point arithmetic.

v3ga commented: Nice info I had to make a program for sqrt without math.h.........thx +2
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It's the same "problem" as the other user who posted a similar "problem". The problem is that you do not understand how computers store and process floating point numbers. The square root function uses a floating point algorithm. The square root of 9 is not (according to the algorithm) exactly 3. It is 3 plus 1.155e-37. Because the decimal part is so small compared to the integer part it it not displayed. However, when you subtract 3 you are left with only the decimal part which can be displayed in scientific notation. I suppose the original answer could have been displayed as 4 + 1.155e-37 but that would be silly.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

syncback from 2brightsparks does it for me and it comes in a free version.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Someone else on the forum posted this code. It may help.

Dim cmdProcess As Process

cmdProcess = New Process()
' Dump all info from ipconfig command
cmdProcess.StartInfo.Arguments = "/ALL"
' Run command: ipconfig
cmdProcess.StartInfo.FileName = "ipconfig"
' Redirect stdout
cmdProcess.StartInfo.RedirectStandardOutput = True
' Set to false, otherwise you can't redirect stdout
cmdProcess.StartInfo.UseShellExecute = False
' Start process
If cmdProcess.Start() Then
    ' Read stdout and show the content in a rtf-box
    RichTextBox1.Text = cmdProcess.StandardOutput.ReadToEnd
Else
    ' Failed to execute command
End If

As for converting the batch file, post it and I'll have a look.

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

What version of vmware are you using?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

It seems to me that your code generator just creates a sequence of random characters. If you don't have an algorithm to generate specific sequences then how are you going to be able to tell what constitutes a valid key?

Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

I did exactly the same thing this summer to troubleshoot a problem with my Rogers Rocket Hub at the cottage. Do you have a question? You don't require a CMD session to execute the ping. A simple (simple enough for my purposes) ping function is

Private Function PingStatus(ByVal addr As String) As String
    Try
        Return IIf(My.Computer.Network.Ping(addr), "UP", "DOWN")
    Catch ex As Exception
        Return "DOWN"
    End Try
End Function
Reverend Jim 5,225 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

When I try a sample it works fine. Put in a break point after you apply the filter and check what data is in the filtered array. You have to add the items in a loop like

dim filtered() as String = Filter(lines,filtertext)

ListView1.Items.Clear

if not filtered is Nothing Then
    for each line as string in filtered
        ListView1.Items.Add(New ListViewItem(line))
    next
end if