|
-
Oct 17th, 2006, 12:03 PM
#1
Thread Starter
Addicted Member
[RESOLVED] on KeyPress error
Hi all,
Just a quick problem -
I have a program that has a text box take focus when the program loads. I want it to display some text, which dissapears if you click / get focus in the box. Kinda like a lable. I also DON'T want it to make the label text dissapear when the program loads. I accheived this with the following code:
Code:
' Global declare thingy
Dim AA as Boolean
' More code
Private Sub MD51in_GotFocus()
If AA = False Then
AA = True
Exit Sub
End If
If MD51in.Text = "Actual MD5 Checksum" Then
MD51in.Text = ""
MD51in.SetFocus
End If
End Sub
Private Sub MD51in_LostFocus()
If MD51in.Text = "" Then
MD51in.Text = "Actual MD5 Checksum"
End If
End Sub
Private Sub MD52in_GotFocus()
If MD52in.Text = "Supposed MD5 Checksum" Then
MD52in.Text = ""
MD52in.SetFocus
End If
End Sub
Private Sub MD52in_LostFocus()
If MD52in.Text = "" Then
MD52in.Text = "Supposed MD5 Checksum"
End If
End Sub
However, I have noticed that if you start typing in that box right away, the "lable text" will remain. I tried countering this using an _change()..
Code:
Private Sub MD51in_Change()
If MD51in.Text = "Actual MD5 Checksum" Then
MD51in.Text = ""
MD51in.SetFocus
End If
End Sub
But it didn't work. The best solution I can think of is to use _KeyPress or _KeyDown:
Code:
Private Sub MD51in_KeyPress()
If MD51in.Text = "Actual MD5 Checksum" Then
MD51in.Text = ""
MD51in.SetFocus
End If
End Sub
But if I try that, it gives the following error:

Any ideas?
-
Oct 17th, 2006, 12:25 PM
#2
Lively Member
Re: on KeyPress error
You need this in your function:
VB Code:
Private Sub MD51in_KeyPress([B]KeyAscii As Integer[/B])
-
Oct 17th, 2006, 12:59 PM
#3
Thread Starter
Addicted Member
Re: on KeyPress error
Perfect! Thanks ^__^
Just another quick Q - Is there a maximum character limit that all MD5 checksums are, or are they all different?
-
Oct 17th, 2006, 01:05 PM
#4
Re: on KeyPress error
I think 65k... but not sure
-
Oct 17th, 2006, 01:06 PM
#5
Thread Starter
Addicted Member
Re: on KeyPress error
65k? Kilobytes? I mean the actual key. thing. For example, the Checksum for Notepad.exe is
388b8fbc36a8558587afc90fb23a3b99
-
Oct 17th, 2006, 01:14 PM
#6
Thread Starter
Addicted Member
Re: on KeyPress error
And this is the hash of a very large file, over 3 gigs:
897685ed1eef183514a3dafcb75115e9
They are all 32 characters - that wouldn't be the limit, would it? Or does it depends on the amounts of files or types of files?
-
Oct 17th, 2006, 01:18 PM
#7
Hyperactive Member
Re: on KeyPress error
 Originally Posted by Arby
They are all 32 characters - that wouldn't be the limit, would it? Or does it depends on the amounts of files or types of files?
"The 128-bit (16-byte) MD5 hashes (also termed message digests) are typically represented as a sequence of 32 hexadecimal digits."
(Taken from Wikipedia)
-
Oct 17th, 2006, 01:21 PM
#8
Thread Starter
Addicted Member
Re: on KeyPress error
Ah, so they are always expressed in 32 characters? I'll put that as the max length then XD.
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|