Wednesday, October 6

PERSONAL VOCABULARY STORER AND TESTER.....



...........PERSONAL VOCABULARY STORER........


Imports System.IO
Public Class Form1
Dim folder() As String
Dim b As String
Private Sub ToolStripButton12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton12.Click
clear()
End Sub
Public Sub reload()
Try
Dim eachfolder As String
ListBox1.Items.Clear()
folder = Directory.GetDirectories("Vocabulary")
For Each eachfolder In folder
b = eachfolder.Substring(eachfolder.IndexOf("\") + 1, (eachfolder.Length) - (eachfolder.IndexOf("\") + 1))
ListBox1.Items.Add(b)
Label6.Text = "No. of Words : " + ListBox1.Items.Count.ToString
Next
Catch ex As Exception
End Try

End Sub
Public Sub clear()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
RichTextBox1.Text = ""
RichTextBox2.Text = ""
End Sub
Private Sub ToolStripButton14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton14.Click
Try
With My.Computer.FileSystem
If .DirectoryExists("Vocabulary\" + TextBox3.Text) Then
.DeleteFile("Vocabulary\" + TextBox3.Text + "\" + "ex")
.DeleteFile("Vocabulary\" + TextBox3.Text + "\" + "se")
.DeleteFile("Vocabulary\" + TextBox3.Text + "\" + "sy")
.DeleteFile("Vocabulary\" + TextBox3.Text + "\" + "an")
End If
.CreateDirectory("Vocabulary\" + TextBox3.Text)
.WriteAllText("Vocabulary\" + TextBox3.Text + "\" + "ex", RichTextBox1.Text, True)
.WriteAllText("Vocabulary\" + TextBox3.Text + "\" + "se", RichTextBox2.Text, True)
.WriteAllText("Vocabulary\" + TextBox3.Text + "\" + "sy", TextBox1.Text, True)
.WriteAllText("Vocabulary\" + TextBox3.Text + "\" + "an", TextBox2.Text, True)
End With
folder = Directory.GetDirectories("Vocabulary")
reload()
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If My.Computer.FileSystem.DirectoryExists("Vocabulary") Then
Else
My.Computer.FileSystem.CreateDirectory("Vocabulary")
End If
reload()
Catch ex As Exception
End Try

End Sub

Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick

End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Try
TextBox3.Text = My.Computer.FileSystem.GetName("Vocabulary\" + ListBox1.SelectedItem.ToString)
RichTextBox1.Text = My.Computer.FileSystem.ReadAllText("Vocabulary\" + ListBox1.SelectedItem.ToString + "\ex")
RichTextBox2.Text = My.Computer.FileSystem.ReadAllText("Vocabulary\" + ListBox1.SelectedItem.ToString + "\se")
TextBox1.Text = My.Computer.FileSystem.ReadAllText("Vocabulary\" + ListBox1.SelectedItem.ToString + "\sy")
TextBox2.Text = My.Computer.FileSystem.ReadAllText("Vocabulary\" + ListBox1.SelectedItem.ToString + "\an")
Catch ex As Exception
End Try

End Sub
Private Sub TrackBar1_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.ValueChanged
Me.Opacity = TrackBar1.Value / 100
End Sub

Private Sub ToolStripButton20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton20.Click
Try
My.Computer.FileSystem.DeleteFile("Vocabulary\" + TextBox3.Text + "\ex")
My.Computer.FileSystem.DeleteFile("Vocabulary\" + TextBox3.Text + "\se")
My.Computer.FileSystem.DeleteFile("Vocabulary\" + TextBox3.Text + "\sy")
My.Computer.FileSystem.DeleteFile("Vocabulary\" + TextBox3.Text + "\an")
My.Computer.FileSystem.DeleteDirectory("Vocabulary\" + TextBox3.Text, FileIO.DeleteDirectoryOption.ThrowIfDirectoryNonEmpty)
reload()
clear()
Catch ex As Exception
End Try
End Sub
End Class

......PERSONAL VOCABULARY TESTER...........
Imports System.IO
Public Class etester
Dim folder() As String
Dim b As String
Dim i, count As Integer
Private Sub etester_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
count = 0
Dim eachfolder As String
ListBox1.Items.Clear()
folder = Directory.GetDirectories("Vocabulary")
For Each eachfolder In folder
ListBox1.Items.Add(count)
count += 1
Next

Catch ex As Exception
End Try
ListBox1.Focus()
End Sub
Private Sub ListBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ListBox1.KeyDown
If e.KeyCode = Keys.A Then
TextBox2.Text = My.Computer.FileSystem.GetName(folder(Integer.Parse(ListBox1.SelectedItem.ToString)))
End If
If e.KeyCode = Keys.D Then
TextBox3.Text = My.Computer.FileSystem.ReadAllText(folder(Integer.Parse(ListBox1.SelectedItem.ToString)) + "\sy")
End If
If e.KeyCode = Keys.W Then
SendKeys.Send("{UP}")
TextBox2.Text = ""
TextBox3.Text = ""
RichTextBox2.Text = ""
End If
If e.KeyCode = Keys.S Then
SendKeys.Send("{DOWN}")
TextBox2.Text = ""
TextBox3.Text = ""
RichTextBox2.Text = ""
End If
If e.KeyCode = Keys.X Then
RichTextBox2.Text = My.Computer.FileSystem.ReadAllText(folder(Integer.Parse(ListBox1.SelectedItem.ToString)) + "\se")
End If
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Try
RichTextBox1.Text = My.Computer.FileSystem.ReadAllText(folder(Integer.Parse(ListBox1.SelectedItem.ToString)) + "\ex")
Catch ex As Exception
End Try
End Sub
End Class

No comments: