Right basically I'm having trouble using if and elseif statements. I cant use these three small pieces of code because I constantly get 'Else must be preceded by an If or ElseIf' but there is nowhere for me to put these without these erroring?Code:Imports System.IO Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click Dim alltext() As String = System.IO.File.ReadAllLines("C:\Users\Parent\Documents\Visual Studio 2008\Projects\Members.txt") Dim lookfor As String = txtLogin.Text & "," If txtLogin.Text = "Admin" And txtPassword.Text = "DWADMIN" Then MsgBox("You are now successfuly logged in") Form2.Show() Me.Hide() 'generic admin login for all staff End If For Each line As String In Filter(alltext, lookfor) If line.StartsWith(txtLogin.Text) Then MsgBox("You are now successfully logged in") Form3.Show() Me.Hide() End If Next If txtLogin.Text = "" Or txtPassword.Text = "" Then MsgBox("Please enter Username/Password") End If




Reply With Quote
