Talk2Tom11
Centurion
Why trying to run an application on my pc i am getting an error message that says that the application does not have permission to do what it wants to do. here are two pictures of the error messages.
The errors are not happening on the computer in which i wrote the program on. Just another computer that is running the program...
this is my code:
Form 1:
Class TextData:
The errors are not happening on the computer in which i wrote the program on. Just another computer that is running the program...
this is my code:
Form 1:
Visual Basic:
Imports System.IO
Imports System.Security.permissions
Private Function ParseFile( _
ByVal fileName As String) _
As Hashtable
Try
Dim data As TextData
Dim table As New Hashtable
Dim reader As New StreamReader(fileName)
Dim text As String = reader.ReadToEnd()
Dim words() As String = _
text.Split(" ,.()[]{}".ToCharArray)
For Each word As String In words
If table.Contains(word) Then
data = DirectCast(table(word), TextData)
data.Count += 1
Else
data = New TextData(word)
table.Add(word, data)
End If
Next
Return table
Catch eexp As Exception
MsgBox("Please Choose a Readable File Joe")
End Try
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim file As String
file = TextBox1.Text
Dim table As Hashtable = _
ParseFile(file)
Try
For Each de As DictionaryEntry In table
With ListBox1.Items
.Add(de.Value.ToString())
End With
'Debug.WriteLine(de.Value.ToString())
'MsgBox(de.Value.ToString())
Next
Catch ex As Exception
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
ofd1.ShowDialog()
TextBox1.Text = ofd1.FileName
End Sub
Class TextData:
Visual Basic:
Public Class TextData
Public Value As String
Public Count As Integer
Public Sub New(ByVal Value As String)
Me.Value = Value
Me.Count = 1
End Sub
Public Overrides Function GetHashCode() _
As Integer
Return Value.GetHashCode()
End Function
Public Overrides Function ToString() As String
Return Me.Value & ":" & Me.Count
End Function
End Class
Last edited: