iPing - My first Application with a GUI!


  1. Posts : 3,904
    Windows 7 Ultimate 64-bit
       #1

    iPing - My first Application with a GUI!


    Well here we are, I present you iPing!

    This program allows you to ping any host, (www.***.com or an IP) and tells you the response in "MS".

    Opinions would be nice, any problems let me know.

    Here is the Source code for any suspicious people:

    Code:
    Option Strict Off
    
    COPYRIGHT HARRIE PATEMAN © 2014-2016
    
    Imports System.Net
    
    Public Class Form1
    
        Dim IPAddress As String
    
        Public Property CheckingPing As Boolean = False
    
    #Region "Ping Function"
        Private Function DoPing(ByVal Address As String) As Long
            Dim p As New NetworkInformation.Ping
            Dim r As NetworkInformation.PingReply
    
            Try
                r = p.Send(Address)
                Return r.RoundtripTime
            Catch ex As Exception
                Return -1
            End Try
        End Function
    #End Region
    
        Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
    
            If CheckingPing = False Then
                If Not TextBox1.Text = String.Empty Then
                    Timer1.Start()
                    Timer1.Enabled = True
                    CheckingPing = True
                    Button1.Text = "Stop"
                    TextBox1.Enabled = False
                Else
                    MessageBox.Show("Please Enter a Host!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                End If
            Else
                Timer1.Stop()
                Timer1.Enabled = False
                CheckingPing = False
                Button1.Text = "Start"
                TextBox1.Enabled = True
            End If
    
        End Sub
    
        Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
    
            Dim ms As Long = DoPing(TextBox1.Text)
    
    
            If ms >= 0 Then
                TextBox2.Text = "Ping: " & ms.ToString & "ms" & " - Online!"
    
            Else
                TextBox2.Text = "Cant connect to """ & TextBox1.Text & """"
                Timer1.Stop()
                Timer1.Enabled = False
                TextBox1.Enabled = True
                CheckingPing = False
                Button1.Text = "Start"
            End If
    
        End Sub
    
        Private Sub Form1_Shown(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Shown
            TextBox1.Focus()
        End Sub
    
        Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    
        End Sub
    
    
        Private Sub GroupBox2_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter
    
        End Sub
    
        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    
            Close()
    
        End Sub
    
        Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    
            AboutBox1.ShowDialog()
    
        End Sub
    
        Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click
            AboutBox1.ShowDialog()
    
        End Sub
    
        Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
    
            AboutBox1.ShowDialog()
    
        End Sub
    End Class
    I Have attached the Setup in a Zip file for you all.
    Attached Thumbnails Attached Thumbnails iPing - My first Application with a GUI!-1.png   iPing - My first Application with a GUI!-2.png  
    iPing - My first Application with a GUI! Attached Files
      My Computer


  2. Posts : 3,904
    Windows 7 Ultimate 64-bit
    Thread Starter
       #2

    Can Someone let me know if it download okay? and the setup went smooth?
      My Computer


  3. Posts : 2,468
    Windows 7 Ultimate x64
       #3

    Seems like a nice and useful one. Let me give my opinion:

    First the "setup". It works as expected, and but just places a shortcut on the start menu. Really, ClickOnce is amont the most unprofessional ways of installing things, it has serious drawbacks and is so coupled with .NET to make it hard to use anywhere else. Just use a serious install system, there are many ones out there, the built-in things in Visual Studio are crap on this. Or even better, just distribute the exe file alone, as it's all you need to run, and you've got a "portable" one.

    Then about the program. It works well, more or less, but with a few things. Under the hood, it keeps pinging until you stop, this is not so evident, the single textbox for the result makes the impression that a single packet it sent while it really keeps bombarding until you stop or exit. The ideal for me would be a grid (the built-in listview in detail mode is great) with a row for each packet, much like the real console-based ping. And if I were to request even more stuff, the option to customize the number of packets and packet size would be great . Just like in the original ping.

    A few bugs: The result textbox must be read-only (not so nice to be able to tamper the results).
    When pinging a non-existent name (a host that the DNS server cannot resolve), the result is "Cant connect to", and the hostname is truncated if it's too long.
    When pinging a non-existent IP (or a name resolved to a non-existeng IP), it reports a 0ms, successful ping, it should return an error instead.
    The window can be maximized. This just fills the whole screen with a blank window with the controls in a corner. Disabling the maximize button will solve this.
    Not really a bug, but pressing enter in the host textbox should initiate ping, and pressing esc could exit immediately. Just eye candy :)

    All in all, nice program.
      My Computer


  4. Posts : 21,004
    Desk1 7 Home Prem / Desk2 10 Pro / Main lap Asus ROG 10 Pro 2 laptop Toshiba 7 Pro Asus P2520 7 & 10
       #4

    Out of my league Harry and mate that is a nom de plume email address? else you will get a bit of spam eh?
      My Computer


  5. Posts : 3,904
    Windows 7 Ultimate 64-bit
    Thread Starter
       #5

    Alejandro85, thank you for the advice. You really seem like you know yours stuff i would like to see some of your work? I understand what you mean about the .exe's my other developments i have just posted the .exe's.

    ICit2lol - spam away
      My Computer


  6. Posts : 21,004
    Desk1 7 Home Prem / Desk2 10 Pro / Main lap Asus ROG 10 Pro 2 laptop Toshiba 7 Pro Asus P2520 7 & 10
       #6

    HarriePateman said:
    Alejandro85, thank you for the advice. You really seem like you know yours stuff i would like to see some of your work? I understand what you mean about the .exe's my other developments i have just posted the .exe's.

    ICit2lol - spam away
    Only the spam you eat in that sandwich you have mate
      My Computer


  7. Posts : 3,904
    Windows 7 Ultimate 64-bit
    Thread Starter
       #7

    yummy
      My Computer


  8. Posts : 21,004
    Desk1 7 Home Prem / Desk2 10 Pro / Main lap Asus ROG 10 Pro 2 laptop Toshiba 7 Pro Asus P2520 7 & 10
       #8

    HarriePateman said:
    yummy
    Frittered I hope
      My Computer


  9. Posts : 2,468
    Windows 7 Ultimate x64
       #9

    HarriePateman said:
    Alejandro85, thank you for the advice. You really seem like you know yours stuff i would like to see some of your work? I understand what you mean about the .exe's my other developments i have just posted the .exe's.
    No problem, nice work, not bad for a first try. Yeah, I know this stuff, I make my living programming I must know it. Never published anything myself, the few things I've done on my own remain in my disk, mostly unused, never think of anyone being interested anyway.

    I still have to try the second version of this one!
      My Computer


  10. Posts : 3,904
    Windows 7 Ultimate 64-bit
    Thread Starter
       #10

    Alejandro85 said:
    HarriePateman said:
    Alejandro85, thank you for the advice. You really seem like you know yours stuff i would like to see some of your work? I understand what you mean about the .exe's my other developments i have just posted the .exe's.
    No problem, nice work, not bad for a first try. Yeah, I know this stuff, I make my living programming I must know it. Never published anything myself, the few things I've done on my own remain in my disk, mostly unused, never think of anyone being interested anyway.

    I still have to try the second version of this one!
    The second one is much better!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 21:33.
Find Us