Hidden-Content
Content Audit Wizard
LEVEL 1
300 XP
This tutorial will teach you how to create a program that sorts the content of file in vb.net.
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add one button named openBTN and an OpenFileDialog1 that we will use to open a particular file such as text file.
3. Now, we will do the coding.
We will first import the IO library.
Then, we will declare the following variables below that we will use for a sub procedure.
We will then create a sub procedure named ProcessFile() to sort the content of the text file that we will going to choose.
And an OpenFile() sub procedure to trigger opening any text files.
Lastly, put this code in your Form_Load.
Output:
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
Now, let's start this tutorial!
1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.
2. Next, add one button named openBTN and an OpenFileDialog1 that we will use to open a particular file such as text file.
3. Now, we will do the coding.
We will first import the IO library.
- Imports
System.
IO
Then, we will declare the following variables below that we will use for a sub procedure.
- Dim
Current As
String
- Dim
myWords As
New
List(
Of
String
)
- Dim
word(
)
As
String
- Dim
I As
Integer
=
0
- Dim
file As
String
(
)
We will then create a sub procedure named ProcessFile() to sort the content of the text file that we will going to choose.
- Private
Sub
ProcessFile(
)
- word =
System.
IO
.
File
.
ReadAllLines
(
Current)
- For
Each
Temp As
String
In
word
- myWords.
Add
(
word(
I)
)
- I +=
1
- Next
- myWords.
Sort
(
)
- FileOpen(
1
, Current, OpenMode.
Output
)
- For
Each
curWord As
String
In
myWords
- PrintLine(
1
, curWord)
- Next
- FileClose(
)
- CloseApp(
)
- End
Sub
And an OpenFile() sub procedure to trigger opening any text files.
- Private
Sub
OpenFile(
)
- With
OpenFileDialog1
- .
Filter
=
"Text Files (*.txt)|*.txt|Rich Text Files (*.rtf)|*.rtf"
- .
FileName
=
""
- OpenFileDialog1.
ShowDialog
(
)
- End
With
- End
Sub
Lastly, put this code in your Form_Load.
- Private
Sub
Form1_Load(
ByVal
sender As
System.
Object
, ByVal
e As
System.
EventArgs
)
Handles
MyBase
.
Load
- file =
Environment.
GetCommandLineArgs
(
)
- If
file.
Length
>
1
Then
- Current =
(
file(
1
)
.
ToString
(
)
)
- ProcessFile(
)
- Else
- OpenFile(
)
- End
If
- End
Sub
Output:

For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]
Add and Follow me on Facebook: https://www.facebook.com/donzzsky
Visit and like my page on Facebook at: https://www.facebook.com/BermzISware
Download
You must upgrade your account or reply in the thread to view the hidden content.