100% found this document useful (1 vote)
300 views4 pages

Problema Nr2 - Visual Basic

This document contains code for analyzing text input from the keyboard, clipboard, or file. It identifies phrases, words, and characters used in the text and counts the frequency of each. Access is password protected with multiple members that can be updated. Input data and results are saved to external memory. The code splits the input text into an array of words, loops through to count the frequency of each unique word, and outputs the results to a text file.

Uploaded by

carolina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
300 views4 pages

Problema Nr2 - Visual Basic

This document contains code for analyzing text input from the keyboard, clipboard, or file. It identifies phrases, words, and characters used in the text and counts the frequency of each. Access is password protected with multiple members that can be updated. Input data and results are saved to external memory. The code splits the input text into an array of words, loops through to count the frequency of each unique word, and outputs the results to a text file.

Uploaded by

carolina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problema nr2.

S se realizeze un proiect Visual Basic prin care s se efectueze analiza


unui text preluat de la tastatur, din clipboard sau dintr-un fiier i s
se identifice cu memorare frazele, cuvintele i caracterele folosite n
text. S se contorizeze de cte ori apare fiecare dintre acestea. Accesul
s se fac pe nivele de prelucrare pe baz de parole, cu membri multipli,
actualizabile. Datele de intrare i rezultatele s se trec pe supori de
memorie extern.

Codul sursa este urmatorul:


Imports [Link]
Public Class Form1
Dim provider As String
Dim dataFile As String
Dim connString As String
Dim myConnection As OleDbConnection = New OleDbConnection
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles [Link]
provider = "Provider=[Link].4.0;Data Source ="
'Change the following to your access database location
dataFile = "C:\Users\Carolina\Desktop\baze\[Link]"
connString = provider & dataFile
[Link] = connString
[Link]()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles [Link]
'the query:
Dim cmd As OleDbCommand = New OleDbCommand("SELECT * FROM [users] WHERE
[utilizator] = '" & [Link] & "' AND [parola] = '" & [Link] & "'", myConnection)
Dim dr As OleDbDataReader = [Link]
' the following variable is hold true if user is found, and false if user is not found
Dim userFound As Boolean = False

' the following variables will hold the user first and last name if found.
'if found:
While [Link]
userFound = True
End While
'checking the result
If userFound = True Then
[Link]()
Else
MsgBox("Sorry, username or password not found", [Link], "Invalid Login")
End If
[Link]()
End Sub
End Class

Codul sursa este urmatorul:


Public Class Form2
Dim v As String
Dim n As Integer
Dim i As Integer
Dim j As Integer
Dim nr As Integer
Dim aux As Integer
Dim aux1 As String
Dim ok As Integer
Dim aux3 As String
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles [Link]

End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles
[Link]
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles [Link]
v = [Link]
'alocam un numar fisierului
Dim nrF As Integer = FreeFile()
'deschidem fisierul in modul Ouput - pt creare
FileOpen(nrF, "f:\[Link]", [Link])
'scriem in fisier linie cu linie
'antetul

n = Len(v)
PrintLine(nrF, "Prelucrare text", TAB(20), [Link])
PrintLine(nrF, "Cuvant", TAB(20), "Numar de apariti")

Dim strSplit() As String


strSplit = [Link](CChar(" "))
aux = [Link]
[Link]("Textul original este : ' " + v + " ' ")
[Link]([Link])
For j = 0 To aux - 1
nr = 1
aux1 = strSplit(j)
ok = 0
For p = 0 To j - 1
If aux1 = strSplit(p) Then
ok = 1
End If
Next
If ok = 0 Then
For i = j + 1 To aux - 1
aux3 = strSplit(Str(i))
If [Link](aux1, aux3) = 0 Then
nr = nr + 1
End If
Next
PrintLine(nrF, [Link], TAB(20), [Link])
[Link]("Cuvantul '" + aux1 + "' apare de " + Str(nr) + " ori ")
[Link]([Link])

End If
Next

FileClose(nrF)
End Sub
End Class

You might also like