VB icon

robert

Email
Submitted on: 5/6/2020 3:43:58 PM
By: robert van herp 
Level: Beginner
User Rating: Unrated
Compatibility: VB 5.0
Views: 847
 
     coderen van tekst en decoderen. in vele toepassingen te gebruiken.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: robert
' Description:coderen van tekst en decoderen. in vele toepassingen te gebruiken.
' By: robert van herp
'**************************************

Option Explicit
Dim c(255, 255), Naam, sleutel, gecodeerd, even As String
Dim t, a, tel, max, plaats, mem, b As Integer
Private Sub maakcodelijst()
'maakt lijst om code te genereren
t = -1
Do Until a = 255
t = t + 1
mem = t
Do Until b = 255
If b + t > 255 Then t = 0
 c(a, b) = c(a, b) + Chr(b + t)
 b = b + 1
Loop
b = 0
a = a + 1
t = mem
Loop
End Sub
Private Sub Command1_Click()
Naam = Text1.Text
sleutel = Text2.Text
'maakt code van de opgegeven naam
plaats = 0
For tel = 1 To Len(Naam)
plaats = plaats + 1: If plaats > Len(sleutel) Then plaats = 1
gecodeerd = gecodeerd + c(Asc(Mid(Naam, tel, 1)), Asc(Mid(sleutel, plaats, 1)))
Next
plaats = 0: Naam = ""
Text3.Text = gecodeerd
'maakt van code weer de naam
t = 0: tel = 0: a = 0
For a = 1 To Len(gecodeerd)
t = t + 1: If t > Len(sleutel) Then t = 1
plaats = Asc(Mid(sleutel, t, 1))
Do Until tel = 255
If c(tel, plaats) = Mid(gecodeerd, a, 1) Then Naam = Naam + c(tel - 1, 1): Exit Do
tel = tel + 1
Loop
tel = 0
Next a
Text4.Text = Naam: Naam = "": gecodeerd = ""
End Sub
Private Sub Form_Load()
Call maakcodelijst
End Sub


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/7/2020 3:21:41 AMRob C

English translation -
Description: encoding text and decoding. can be used in many applications.
'By: robert van herp

By the way, when you do this -
Dim c(255, 255), Naam, sleutel, gecodeerd, even As String
Dim t, a, tel, max, plaats, mem, b As Integer
Only the variable on the end gets to be String or Integer
All the others become variants, which can cause problems.

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.