This is only meant for beginners as the good coders will know this thing.
I am writing this for you to teach you how to use Arrays to store one or more things in it. You will be wondering we can also do this without Array, but guy it will be really difficult because for that you may have to declare thousands of string for that and it will take lot of time.
Everything i have showed you by comments so you can easily understand what the code is doing is.
Example:-
[img]http://k.min.us/jkwYNe.png[/img]
If you like flaming that don't forget this is only for beginners.
Enjoy! and don't forget to comment 👍
Good tutorial!
I've written the code down and stored it in my vb.codes txt file ! XD
Thank you for this informative tutorial.
(Apr 13, 2011 06:39 AM)★Cooldude★ Wrote: Thank you for this informative tutorial.
Thanks for +Rep CoolDude and also for like. Also thanks to wertyl11 for like.
And Any1 if you need any help just ask here and i will try my best to solve it.
DO NOT DEAL WITH THIS MEMBER
This is not a tutorial. You didn't explain it well.
(Apr 13, 2011 07:24 AM)H3x0S Wrote: This is not a tutorial. You didn't explain it well.
We can call it Mini-Tut. I tried my best to explain all the things i know with ease and now "NOT EXPLAINED VERY WELL"
Ok, I guess that this is a good tutorial if you are newer to coding.
Nice job.
If this was a tutorial about arrays i would at least expect to see you mention an array is a fixed-size structure for storing data. There is no mention that you create an array with a specific number of elements that can not change. Even if an item is empty the size still remains. Where is the information a user would need to resize an array? When would you use an array over a List(Of T)? Or vice versa....
You are not telling vb any thing. A Net application is compiled to MSIL code. Which you can look at as a set of instructions. When you execute your app it gets compiled on the fly by Just-in-Time compiler which then compiles it to native code.
Think of it as talking on the phone. You maybe sending the message through the phone but thats as far as it's involvement goes.
You could also show how to use something like this:
Code If Authentication.Authenticate(ini, New String() {Account, Pass}) Then
This is for authentication for a game.
The full code:
Code Imports System.Text
Imports Native
Imports System.IO
Public Class Authentication
Public Shared Function Authenticate(ByVal Ini As IniFile, ByVal Original As String()) As Boolean
Dim str As String = Password.EncryptPassword(Encoding.ASCII.GetString(Authentication.GetPassword(Ini)))
Dim fileNameWithoutExtension As String = Path.GetFileNameWithoutExtension(FileKernel.GetAccount(Original(0))(0))
Return ((str = Original(1)) AndAlso (fileNameWithoutExtension = Original(0)))
End Function
Public Shared Function GetPassword(ByVal Ini As IniFile) As Byte()
Return Encoding.ASCII.GetBytes(Ini.ReadString("Account", "Password", "1234"))
End Function
Public Shared Function Process(ByVal Account As String, ByVal Pass As String) As NetworkAuth
Dim auth As New NetworkAuth()
auth.LogonType = 255
auth.Character = ""
Try
Dim flag As Boolean = False
Do While Not flag
If FileKernel.AccountExist(Account) Then
Dim ini As New IniFile(("Database\Accounts\" & Account & ".ini"))
If Authentication.Authenticate(ini, New String() {Account, Pass}) Then
auth.Character = ini.ReadString("Account", "Character", "")
Dim character As String = auth.Character
If ((Not character Is Nothing) AndAlso (character = "")) Then
auth.LogonType = 2
Else
auth.LogonType = 1
End If
Else
auth.LogonType = 255
End If
End If
flag = True
Loop
Return auth
Catch exception As Exception
Console.WriteLine(exception.ToString)
End Try
Return auth
End Function
End Class
But over all a good tut:)
DO NOT DEAL WITH THIS MEMBER
(Apr 13, 2011 10:06 AM)BaussHacker Wrote: You could also show how to use something like this:
Code If Authentication.Authenticate(ini, New String() {Account, Pass}) Then
This is for authentication for a game.
The full code:
Code Imports System.Text
Imports Native
Imports System.IO
Public Class Authentication
Public Shared Function Authenticate(ByVal Ini As IniFile, ByVal Original As String()) As Boolean
Dim str As String = Password.EncryptPassword(Encoding.ASCII.GetString(Authentication.GetPassword(Ini)))
Dim fileNameWithoutExtension As String = Path.GetFileNameWithoutExtension(FileKernel.GetAccount(Original(0))(0))
Return ((str = Original(1)) AndAlso (fileNameWithoutExtension = Original(0)))
End Function
Public Shared Function GetPassword(ByVal Ini As IniFile) As Byte()
Return Encoding.ASCII.GetBytes(Ini.ReadString("Account", "Password", "1234"))
End Function
Public Shared Function Process(ByVal Account As String, ByVal Pass As String) As NetworkAuth
Dim auth As New NetworkAuth()
auth.LogonType = 255
auth.Character = ""
Try
Dim flag As Boolean = False
Do While Not flag
If FileKernel.AccountExist(Account) Then
Dim ini As New IniFile(("Database\Accounts\" & Account & ".ini"))
If Authentication.Authenticate(ini, New String() {Account, Pass}) Then
auth.Character = ini.ReadString("Account", "Character", "")
Dim character As String = auth.Character
If ((Not character Is Nothing) AndAlso (character = "")) Then
auth.LogonType = 2
Else
auth.LogonType = 1
End If
Else
auth.LogonType = 255
End If
End If
flag = True
Loop
Return auth
Catch exception As Exception
Console.WriteLine(exception.ToString)
End Try
Return auth
End Function
End Class
But over all a good tut:)
Read the post above yours.
(Apr 13, 2011 10:07 AM)H3x0S Wrote: Read the post above yours.
Oh. I didn't read any posts haha. Just the OP and hitted reply. 🤝
(Apr 13, 2011 09:43 AM)ident Wrote: ![[Image: 7b44babb14f03e30325cda4029056af9.png]](https://gyazo.com/7b44babb14f03e30325cda4029056af9.png)
How do you get VB to look like that?
(Apr 13, 2011 10:42 AM)★Cooldude★ Wrote: How do you get VB to look like that? There is some tools that do it otherwise you can do this:
Tools -> Options -> Fonts and colors
I don't understand what does this program do :O
this is a good tutorial bcz I needed to use a array but i'm novice in VB.NET, I code in php, js, python and others but new in vb, so that's the perfect tutorial I need :)
|