Help Meh!

Posts 1–10 of 10 · Page 1 of 1
Help Meh!
heres some code for a project
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Label2.Text.Contains(TextBox1.Text) Then
            Label4.Visible = True
            Label4.Text = "You Are Banned!"
        Else
            Label4.Visible = True
            Label4.Text = "Not Banned. :/"
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Text = ShowIp()
        Dim Read As New System.IO.StreamReader(Application.StartupPath & "Adress.txt")
        TextBox1.Text = "89.565.676.676" & Environment.NewLine & Read.ReadToEnd
        Read.Close()
    End Sub
the only thing is that, if i had xx.xxx.xxx.xxx in textbox1.text and 89.565.676.676 it would not detect: " If Label2.Text.Contains(xx.xxx.xxx.xxx)
Just Pm me the project, Ill fix it
Quote Originally Posted by NextGen1 View Post
Just Pm me the project, Ill fix it
lol ......

i dont see how that helps him learn. you know? if someones always just *fixing* the problem for you, you never learn.


@ mnpeep

explain more?
@help
Your right, however he would still have to paste the code to fix the error as is (or more of it) And either Myself, Yourself, Lolland, or Bombsaway would have resolved the issue anyway by discovering the problem and posting the solution, I was just trying to make my life easier and not have to create the controls

@explain more,

That's why I suggested the PM, the error could be derived from another part in the code, the snippet won't help, because to the best of my knowledge, there "is nothing wrong"

He is using my "real" Ip tutorial to create a IPaddress block for his software

Code:
 If Label2.Text.Contains(TextBox1.Text) Then
            Label4.Visible = True
            Label4.Text = "You Are Banned!"
        Else
            Label4.Visible = True
            Label4.Text = "Not Banned. :/"
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Text = ShowIp()
        Dim Read As New System.IO.StreamReader(Application.StartupPath & "Adress.txt")
        TextBox1.Text = "89.565.676.676" & Environment.NewLine & Read.ReadToEnd
        Read.Close()
Why does everyone make things complicated , when it could be achieved so easily
I created the module, use it

Code:
Form Load
  If ShowIp() = "45.286.279.68" Then
            MsgBox("Your banned")
        Else
            MsgBox("Welcome")
        End If

Code:
or use texbox1.text = showip()
Code:
If textbox1.text = "62.98.132.453" then 
Yada yada yada 
end if
You get the idea, If your already using my module, then may as well take advantage if it's simplicity


Now you can get more advanced and create a database and have the database on a server and have use it to ban in real time
why so complicated? to make multiple IP bans, but it only detects 1 IP at a time for some reason...
You will have to check the application users IP
Yeah, it would make life easier,

Edit: One sec, I see whats wrong, It's loading but not "nextline" (vbCRLF)

let me see...

I'm replacing your textbox with a List view control, this should work ;p

Here you go

Code:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Label2.Text.Contains(ListView1.Text) Then
            Label4.Visible = True
            Label4.Text = "You Are Banned!"
        Else
            Label4.Visible = True
            Label4.Text = "Not Banned. :/"
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label2.Text = ShowIp()

        Dim str As String = ""
        Dim ary() As String
        str = My.Computer.FileSystem.ReadAllText(Application.StartupPath & "Adress.txt")
        ary = Split(str, vbNewLine)
        Dim x As Integer
        For x = 0 To UBound(ary)
            If ary(x) <> "" Then
                ListView1.Items.Add(ary(x))
            End If
        Next
    
    End Sub
End Class
Add a listview instead of textbox and replace your code with the one above.

It should now download a list and check it against the file.
(works for me)
thanks button says all XD
As always not a problem
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us