Results 1 to 3 of 3

Thread: [RESOLVED] Whats wrong with mycode?

  1. #1

    Thread Starter
    Lively Member networkmancer's Avatar
    Join Date
    Jan 2011
    Posts
    98

    Resolved [RESOLVED] Whats wrong with mycode?

    Gives me this error:Conversion from string "asd" to type 'Boolean' is not valid.
    Immediate window: A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll

    Code:
    If tb1.Text Or tb2.Text = "" Then
                MsgBox("Please input all fields", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Error")
            Else
                MkDir("C:\Windows\Accounts" + tb1.Text)
                Dim username As New System.IO.StreamWriter("C:\Windows\Accpimts" + tb1.Text + "\" + "username.txt")
                username.Write(tb1.Text)
                username.Close()
                Dim password As New System.IO.StreamWriter("C:\Windows\Accpimts" + tb1.Text + "\" + "password.txt")
                password.Write(tb1.Text)
                password.Close()
                MsgBox("Account Created", MsgBoxStyle.Information, "Accounts Created")
            End If
            Me.Hide()
    
            Form1.Show()
        End Sub

  2. #2
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Sydney
    Posts
    311

    Re: Whats wrong with mycode?

    This line:
    vb Code:
    1. If tb1.Text Or tb2.Text = "" Then

    Should be:
    vb Code:
    1. If tb1.Text = "" Or tb2.Text = "" Then
    Why do today what you can tomorrow...

  3. #3

    Thread Starter
    Lively Member networkmancer's Avatar
    Join Date
    Jan 2011
    Posts
    98

    Re: Whats wrong with mycode?

    Ow i did not know that. Thanks a lot. I thought it was possible to do that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width