Post Reply 
VB.net help
Author Message
ZiNgA BuRgA
Smart Alternative

Posts: 17,022.2988
Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
Offline
Post: #19
RE: VB.net help
I don't know if this is valid VB.NET syntax (you'll have to look it up), but this is probably what you should write.  I hope you can understand the logic of the code.

Well...
Spoiler for Solution:

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Public Class PswrdScreen
	' this is stored globally, so that we remember the number of tries between
	' each attempt
	' Note, I've made this "zero based" (starts at 0) because IDK what the Form_Load()
	' function in Vb.NET is
	Dim Attempt As Integer
	
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGuess.Click
        Dim Password As String
        Dim F1 As New Form1
        Dim F3 As New Form3
        Password = "test"
		
		' If the user has had too many attempts...
		If Attempt >= 3 Then
			MsgBox("You have tried and failed too many times, my friend")
			Close()
		End If
		
		' Show the user the number of attempts made
		Attempt = Attempt + 1
		lblAttempt.Text = "Enter password. This is attempt number " & Attempt
		
		' validate password
        If txtPass.Text = Password Then
            MsgBox("This password is valid!")
            F3.Show()
            Close()

        Else
            MsgBox("This password is invalid!")
			' We don't need to close this form!
            'F1.Show()
            'Close()

        End If
    End Sub

    Private Sub txtPass_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPass.TextChanged

    End Sub
End Class

How does this work without a loop?  Well, think of it as a user initiated loop.

If you still want to take a punt at it, I'll give you a hint - using a loop is probably not the best way (might be if you were writing C).
03/11/2007 07:19 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
VB.net help - roberth - 11/10/2007, 11:38 AM
RE: VB.net help - UncertainGod - 11/10/2007, 11:47 AM
RE: VB.net help - ZiNgA BuRgA - 11/10/2007, 08:00 PM
RE: VB.net help - roberth - 12/10/2007, 02:21 AM
RE: VB.net help - diego - 12/10/2007, 02:32 AM
RE: VB.net help - ZiNgA BuRgA - 12/10/2007, 03:25 AM
RE: VB.net help - roberth - 31/10/2007, 01:41 PM
RE: VB.net help - ZiNgA BuRgA - 31/10/2007, 06:43 PM
RE: VB.net help - |-Anubis-| - 31/10/2007, 06:46 PM
RE: VB.net help - ZiNgA BuRgA - 31/10/2007, 06:47 PM
RE: VB.net help - roberth - 01/11/2007, 04:22 AM
RE: VB.net help - roberth - 02/11/2007, 04:53 AM
RE: VB.net help - ZiNgA BuRgA - 02/11/2007, 07:07 AM
RE: VB.net help - roberth - 02/11/2007, 07:59 AM
RE: VB.net help - ZiNgA BuRgA - 02/11/2007, 07:04 PM
RE: VB.net help - roberth - 03/11/2007, 04:04 AM
RE: VB.net help - ZiNgA BuRgA - 03/11/2007, 04:50 AM
RE: VB.net help - roberth - 03/11/2007, 05:00 AM
RE: VB.net help - ZiNgA BuRgA - 03/11/2007 07:19 AM
RE: VB.net help - roberth - 04/11/2007, 05:36 AM
RE: VB.net help - ZiNgA BuRgA - 04/11/2007, 06:42 PM
RE: VB.net help - roberth - 10/12/2007, 03:06 AM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)

 Quick Theme: