Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

SkypeResolver

Hello Guys ✌,

Simple SkypeResolver

[Image: sy621Au.png]

What you need :

2x Textbox
1x Button

Source Code :
Code
Imports System.Net

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim SkypeResolver As New WebClient
        Dim IP As String = SkypeResolver.DownloadString("http://abrasivecraft.com/api.php?cmd=10&username=" + TextBox1.Text)
        TextBox2.Text = IP
    End Sub
End Class


-mnjx
4 ways to improve this code.

1. You should always try and handle errors if they occur using Try Catch statements.
2. Also, it's a good practise to dispose webclient component when you're done using it. So using a using block.
3. And why not assign downloadedstring to textbox2.text straight away instead of making a variable called IP?
4. Add some data validation for textbox1.
The website api isn't even working, always returns "IP Address Not Found"
(Sep 1, 2014 06:01 AM)ElementalTree Wrote:  The website api isn't even working, always returns "IP Address Not Found"

Mhh i dont know for me its working fine 😶
Really thanks bro very useful :D D

to short aiohdssoidjas

[warn]
(Aug 31, 2014 06:08 AM)+Haze Wrote:  4 ways to improve this code.

1. You should always try and handle errors if they occur using Try Catch statements.
2. Also, it's a good practise to dispose webclient component when you're done using it. So using a using block.
3. And why not assign downloadedstring to textbox2.text straight away instead of making a variable called IP?
4. Add some data validation for textbox1.

1. Uh not really. Preventing the error is in most cases better than catching.
2. True, but do you know why it is a good practice ?
3. I'd actually do it like he did as well. What's wrong with having a variable?
4. The only real validation I can think of is checking if it the text box is empty or not. Are there any more ?
https://github.com/Washi1337

"I'll tell you this UDP joke, and I don't care if you will get it or not."
(Sep 1, 2014 06:01 AM)ElementalTree Wrote:  The website api isn't even working, always returns "IP Address Not Found"

Iv been using thier api for a while and it seems to resolver "better" when there are less people on. for example midday sometimes it wouldnt work for me.
(Sep 1, 2014 10:29 PM)Washi Wrote:  1. Uh not really. Preventing the error is in most cases better than catching.
2. True, but do you know why it is a good practice ?
3. I'd actually do it like he did as well. What's wrong with having a variable?
4. The only real validation I can think of is checking if it the text box is empty or not. Are there any more ?

1. Let's say the website happened to be offline, how is he going to prevent that in this case? That's why I think he should use a Try Catch statement.
2. I think it's because if its not disposed its still hanging around in the memory and that's not good. And also, in everyday life stuff its always good to throw away something when you've finished using it.
3. Nothing. It's mere preference, but its always good to shorten your code when and if you can. That doesn't mean shorter code is better, but if you can then you should.
4.Like Odus said, the range of the character length.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by GiommiFeb 5, 2014 11:58 AM 7 408 Feb 5, 2014 11:58 AM
Last Post: geraldososa
[.NET] by xStayOsJan 12, 2013 03:17 PM 20 575 Jan 12, 2013 03:17 PM
Last Post: MaikenBaiken32