Estou fazendo um loader pro meu amigo, e quero logar atraves do fórum(consegui fazer isso e ta pegando direito) mas quando coloco o Me.Hide() e depois Form2.Show()
a form 2 abre mas fecha imediatamente, ai ta o codigo se alguem souber arrumar me fala como pls:
Código:
a form 2 abre mas fecha imediatamente, ai ta o codigo se alguem souber arrumar me fala como pls:
Código:
Código:
Public Class Form1
Private Codigo_Font As String
Private MySite As String = "http://loginteste.forumeiros.com/login"
Public Sub Login()
Using Web As New Net.WebClient
Dim T As New Specialized.NameValueCollection
T.Add("username", TextBox1.Text)
T.Add("password", TextBox2.Text)
T.Add("autologin", "off")
T.Add("redirect", "")
T.Add("query", "")
T.Add("login", "Conectar-se")
Dim Web_Bytes As Byte() = Web.UploadValues(MySite, "POST", T)
Dim Web_HTML As String = (New System.Text.UTF8Encoding).GetString(Web_Bytes)
Codigo_Font = Web_HTML
End Using
If Codigo_Font.Contains("Você especificou um nome de Usuário ou Senha inválida, incorreta ou inativa") Then
MsgBox("Usuário ou Senha incorreto", MsgBoxStyle.Exclamation)
Else
MsgBox("Logado com sucesso", MsgBoxStyle.Information)
Me.Hide()
Form2.Show()
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Control.CheckForIllegalCrossThreadCalls = False
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox1.Text = Nothing Then
Me.Text = "Informe um usuário"
Exit Sub
End If
If TextBox2.Text = Nothing Then
Me.Text = "Informe uma senha"
Exit Sub
End If
Dim T As New Threading.Thread(AddressOf Login)
T.Start()
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
End Class