Documente online.
Zona de administrare documente. Fisierele tale
Am uitat parola x Creaza cont nou
 HomeExploreaza
upload
Upload




Proiect Bazele Programarii-Visual Basic

visual basic


ALTE DOCUMENTE



Proiect Bazele Programarii-Visual Basic

Cuprins

Introducere 2

Controale Visual Basic 3

1.Controale de tip buton 3

2.Controale care afiseaza imagini 3

3.Controale eticheta    4

4.Controale caseta cu text 4

5.Controale cu optiuni pentru utilizator 5

6.Controale de acces la date 6

7.Controale pentru sistemul de fisiere 6

8.Alte controale 7

Problema 1    8

Problema 2    27

Problema 3    30

Problema 4    34

Problema 5    36

Problema 6    40

Problema 7    52

Introducere

Deceniul 6 al secolului 20 a adus cu sine apariția programarii structurate, ceea ce a constituit unul dintre pașii semnificativi in evoluția ingineriei software, aceasta paradigma de programare dominand o buna bucata de timp lumea programarii. Programarea structurata este susținuta de limbaje de generația 3 cum sunt C,PASCAL,BASIC principala caracteristica a lor fiind utilizarea subprogramelor ca modalitate de gestionare a complexitații. Programarea structurata s-a dovedit a fi o modalitate corespunzatoare de abstractizare a operațiilor și a algoritmilor,dovedindu-și eficiența in gestionarea programelor a caror complexitate putea fi controlata de catre un singur programator sau de catre un numar restrans de programatori.

Odata cu creșterea dimensiunii și complexitații proiectelor software a devenit tot mai clar ca pentru a le putea controla este absolut necesara abstractizarea datelor și ca in acest scop programarea structurata nu mai este suficienta. In 1984 Shankar afirma ca :”Natura abstractizarilor ce pot fi obținute prin utilizarea procedurilor este adecvata descrierii operațiilor abstracte, dar nu este adecvata descrierii obiectelor abstracte. Aceasta este o carența majora de vreme ce in multe aplicații complexitatea obiectelor de date care trebuiesc manipulate contribuie substanțial la complexitatea globala a problemei”.

Visual Basic reprezinta o varianta și totodata o dezvoltare a vechiului limbaj de programare Basic. Visual Basic este un mediu de dezvoltare de i 222d36c nalta productivitate, conceput pentru sistemul de operare Windows, cu ajutorul caruia intr-un timp record se pot elabora diferite aplicații Windows. Aflat la versiunea 7.0 lasnata in anul 2000, produsul reprezinta un varf al sistemelor de programare sub Windows. Deși simplu, Visual Basic poate realiza tot ce se poate realiza cu oricare alt limbaj de programare sub Windows. Este un mediu integrat de dezvoltare, deoarece integreaza funcții de proiectare, editare de text, compilare și depanare in cadrul unui mediu comun. Visual Basic este un limbaj interactiv, adica interpreteaza fiecare instrucțiune pe masura ce e introdusa de la tastatura, compiland parțial codul semnaland orice eroare sintactica sau, daca instrucțiunea este corecta, executand-o.

Controale Visual Basic

In Visual Basic obiectele se mai numesc și controale și acestea pot fi: butoane de comanda, butoane de opțiune, casete de dialog, casete de validare, bare de derulare,etc.

Un control are o anumita forma, dimensiune, culoare și un text sau o eticheta. Astfel un control dispune de proprietați, metode și evenimente. Obiectele ii permit utilizatorului sa dea comenzi programului. Visual Basic permite sa scrie cod pentru propietațile, metode și evenimentele unui control.

Proprietațiile unui control descriu controlul respective(ca dimensiune,culoare).

Metodele unui control permit efectuarea unor acțiuni ale controlului, cum ar fi poziționarea și redimensionarea.

Evenimentele unui control permit scrierea codului pentru a raspunde la o acțiune.

Odata plasat pe un formular,unui control i se pot modifica proprietațile, i se pot apela metodele și se poate scrie cod pentru evenimentele sale.

In Visual Basic controalele pot fi grupate in mai multe categorii,astfel:

Controale de tip buton.

Acestea sunt de doua tipuri:

Buton de comanda-Command Button

Un buton de comanda afișeaza o eticheta, permițand utilizatorului sa efectueze diverse acțiuni executand click mouse pe el. Controlul “Buton de Comanda” este utilizat pentru a incepe, a intrerupe sau a sfarși un proces. Pentru a modifica eticheta implicita afișata pe un buton se va atribui propietații Caption o alta valoare.

Buton image-Image Button

Unui buton imagine i se pot da valori prin proprietatea „Style” folosind apoi propritațile „Picture”,”DownPicture” și „DisablePicture”.

Controale care afișeaza imagini și grafica.Acestea sunt:

Controlul imagine

Controlul forma grafica(shape)

Controlul linie

Controlul caseta cu imagini

Primele trei sunt denumite și controale grafice de categorie ușoara, folosind mai puține resurse ale sistemului și fiind afișate mai repede decat controulul caseta cu imagine.

Controlul Imagine este folosit pentru a afișa imagini de tipul:pictograme ,bitmap,metafile imbunatațit sau fișiere JPG sau GIF.El poate fi folosit pe post de buton de comanda. Imaginile se incarca in controlul imagine prin propietatea Picture.

Controlul forma(shape) se folosește la desenarea unor forme grafice predefinite pe suprafata unui formular ca:dreptungi,patrat,oval,cerc,patrat sau dreptunghi cu colțuri rontunjite.Acest control are doar rol decorativ nesuportand nici un eveniment. Pentru fiecare forma dintre acestea se poate stabili stilul,culoarea,stilul de umplere si de linie ,stilul si culoarea chenarului cu ajutorul propietaților: FillStyle și BackStyle,BorderStyle,BorderColor,BackColor,FillColor,Height si Width(pentru dimensiuni).

Controlul Linie(Line) este folosit pentru a genera segmente de linie pe un formular. Nici el nu raspunde la nici un eveniment. Poate fi folosit doar la desenarea liniilor drepte. Stiulul liniei poate fi specificat prin propietatea BorderStyle;culoarea liniei poate fi stabilita cu propietatea BorderColor. Acest control poate fi redimensionat cu ajutorul propietaților X 1,X 2,Y 1 si Y 2.

Controlul caseta cu imagine(Picture Box) este folosit pentru afișarea graficii,ca un container pentru alte controale,pentru a afișa ieșiri de date pornind de la metodele grafice,pentru a afișa text cu metode Print,pentru a afișa animații simple. Incarcarea unei imagini in caseta cu imagine se face cu ajutorul propietații Picture. Controlul caseta cu imagine are mai multe metode grafice:Circle,Line,Point și Pset servind la desenarea de grafica pe caseta cu imagine(atribuind valoarea True propietații AutoRedraw).

3.Controale Eticheta(Label)

Acest control afișeaza text care poate fi doar citit,nu și modificat in mod direct de catre utilizator. Totuși,controalele etichete pot afișa diferite mesaje,care se pot schimba in funcție de context. Astfel textul etichetei se controleaza prin propietatea Caption și este folosit pentru a indentifica obiectele unui formular,a afișa informații ca raspuns la un eveniment sau process de aplicație,a identifica controale care nu au propietatea Caption, a adauga text descriptiv la un formular,la crearea tastelor de acces pentru celelalte controale.

4.Controale caseta cu text(Text Box)

Acest control permite introducerea unui text de la tastatura și/sau afișeaza un text introdus de utilizator sau rezultat din evaluarea unei expresii.Acest text este controlat de propietatea Text și poate fi modificat doar in cazul in care propietatea Locked nu are valoarea True.

Schimbarea fontului cu care este scris textul intr-o caseta cu text este controlata de propietatea FontName. Implicit Visual Basic Afișeaza textul dintr-o caseta cu text alb-negru,dar permite schimbarea culorii din prim-planul textului cat și culoarea de fond.

Lista de propietați a acestui control conține circa 34 propietați, dintre care :

Name: indetificatorul obiectului respectiv;

Format: specifica formatul de afișare;

Status Bar Text: corespunde mesajului ce va fi afișat in bara de stare atunci cand cursorul este poziționat pe caseta de text;

Visibile: poate avea valoarea True pentru cazul in care se dorește ca obiectul respectiv sa fie invizibile;

Locked: poate interzice accesul la conținutul controlului,caz in care aceasta propietate are valoarea True;

Scroll Bars: adauga bare de defilare;

Left,Top,Width,Height: precizeaza poziția pe ecran/forma;

Back Color: culoarea fundalului;

Font Color: culoarea dinaintea fundalului;

Border Style,Border Color,Border Width,Font Italic,Font Underline: informații referitoare la caracterele textului;

Text Align cu variantele: General,Left,Center,Right;

Multiline: permite scrierea pe mai multe randuri(valoarea True).

5.Controale cu opțiuni pentru utilizator

Visual Basic pune la dispoziția utilizatorilor sai mai multe controale standard oferindu-le posibilitați de alegere:

Caseta de validare-Check Box

Butoane de opțiune-(Butoane Radio)-Option Button

Caseta cu lista-List Box și Combo Box

Controlul caseta de validare (Check Box). Permite utilizatorului sa aleaga una sau mai multe obțiuni și afișeaza un marcaj de validare cand este selectat. Aceasta caseta arata daca o condiție este indeplinita sau nu. Starea controlului caseta de validare este controlata de propietatea Value: invalidat are valoarea 0, validat are valoarea 1 și indisponibil are valoarea 2. In mod implicit Check Box se afla in starea invalidat. Aspectul acestei casete se stabilește cu propietațile: Style, Picture, DownPicture și DisablePicture.

Controlul butoane de opțiune( Obtion Button) se folosește pentru a afișa o lista de obțiuni dintre care utilizatorul poate alege una singura la un moment dat. Butoanele de obțiune sau butoanele radio (cum se mai numesc) trebuie sa faca parte dintr-un grup de butoane, selectarea unuia dintre ele ducand la invalidarea imediata a celorlalte. Aspectul unui astfel de control se stabilește cu propietațile: Style, Picture, DownPicture și DisablePicture. Starea controlului este controlata de propietatea Value,care are valoarea True daca butonul este selectat și False in caz contrar.

Controlul de tip caseta cu lista prezinta doua posibilitați:

Caseta cu lista –Lista Box

Caseta combinata-Combo Box

Controlul Caseta cu lista(List Box) afișeaza pe verticala o lista de obțiuni din care utilizatorul poate alege una sau mai multe elemente. Pentru a adauga un element la caseta cu lista se utilizeaza metoda AddItem cu sintaxa

NumeCaseta.AddItem element [,index], in care

NumeCaseta reprezinta numele casetei cu lista, element reprezinta șirul de caractere care trebuie adaugat in lista;

Index reprezinta poziția in care va fi inserat elemental in lista.Daca aceasta are valoarea 0 elementul va fi adaugat la inceputul listei,iar daca lipsește elemental va fi adaugat la sfarșitul listei.

Ștergerea unui anumit element din lista se face cu metoda de RemoveItem, care are același format cu AddItem, putand specifica deci poziția din lista a elementului de șters.

Ștergerea tuturor elementeleor din lista se face cu metoda Clear,cu sintaxa : NumeCaseta.Clear.

In mod implicit, elementele dintr-o caseta cu lista sunt afișate pe verticala pe o singura coloana;lista poate avea insa și mai multe coloane. Crearea casetelor cu lista multicoloana și multiselecție se face atribuind valorii corespunzatoare propietaților Columns și MultiSelect.

Controlul caseta Combinata(Combo Box) ofera utilizatorului o lista de obțiuni reunind caracteristicile unei casete cu text cu cele ale unei casete cu lista. Controlul caseta combinata ofera in plus utilizatorului posibilitatea sa selecteze un element din lista sau sa introduca text la tastatura in caseta combinata. Se recomanda folosirea casetei combinate in locul casetei cu lista atunci cand exista o lista de obțiuni sugerate sau cand se dorește economisirea spațiului formularului. Caseta combinata are trei stiluri gestionate de propietatea Style:

Derulanta-DropDown Combo este stilul implicit cand propietatea Style are valoarea 0.Utilizatorul poate introduce text direct sau poate deschide lista de obțiuni a casetei;selectarea uneia dintre obțiuni are ca efect inversarea acesteia in zona cu text din partea superioara a casetei combinate;

Simpla-Simple Combo este o caseta in care lista de obțiuni este intodeauna vizibila,propietatea Style avand valoarea 1.Utilizatorul poate selecta o obțiune sau poate introduce text direct.

Lista derulanta-DropDown List afișeaza o lista de obțiuni cand utilizatorul executa click pe sageata din dreapta a casetei,propietatea Style avand valoarea 2.Utilizatorul poate selecta o obțiune,dar poate introduce text.

6. Controlul de acces la date.

Controalele de date permit crearea aplicațiilor pentru date fara a fi necesara scrierea unui cod special.Astfel Visual Basic incorporeaza urmatoarele controale de acces la date:

ADO Data creeaza rapid legaturi intre controalele asociate datelor (oricare poseda propietatea DataSource) și o baza de date.;

Data list și Data Combo asemanatoare cu contoalele standard caseta cu lista și caseta combinata;

Data Grid afișeaza datele asemanator unei foi de calcul tabelar sub forma de randuri si coloane;

Microsoft Hierarchical FlexGrid (MSHFlexGrid) și Microsoft FlexGrid(MSFlexGrid) vizualizeaza sub forma de grila datele dintr-un set de inregistrari care provin din una sau mai multe tabele;

Data și Remote Data (date de la distanța) sunt incluse in Visual Basic pentru compatibilitatea cu versiunile mai vechi.

7. Controale pentru sistemul de fișiere

Sistemul de fișiere poate fi exploatat in doua modalitați:

Utilizarea controlului dialog usual;

Utilizarea combinata a celor trei controale specific sistemului de fișiere care permit vizualizarea unitaților de disc,directoarelor,fișierelor.

Controalele specific sistemului de fișiere:

DriveListBox- caseta cu lista a unitaților de disc-ofera o lista derulanta a unitaților de disc din care utilizatorul poate alege.Implicit unitatea de disc afișata este cea curenta;

DirListBox – caseta cu lista a directoarelor – afișeaza o lista cu structura de directoare a unitații de disc curente, pornind de la directoarele de nivel maxim;

FileListBox –caseta cu lista a fișierelor-afișeaza o lista cu numele fișierelor din cadrul directorului curent selectat(specificat de propietatea Path la momentul execuției).

8.Alte controale :

Controlul de timp- Timer – Masoara trecerea timpului și poate fi folosit pentru a creea un eveniment la interval de timp regulate;

Evenimentul pe care il declanșeaza controlul Timer se numește eveniment Timer,iar procedura aferenta acestui eveniment unde putem scrie cod este NumeTimer_Timer() (NumeTimer este valoarea propieatații Name a controlului Timer).Controlul timer este invizibil in timpul execuției programului.

Controlul container OLE - permite legarea sau incapsularea intr-o aplicație Visual Basic a unor obiecte din cadrul altor aplicații,precum și accesul la facilitațile oricarei aplicații ce permite OLE;

Controlul dialog usual-Common Dialog - aceasta adauga intr-o aplicație Visual Basic un set standard de casete de dialog pentru:

-Deschiderea și salvarea fișierelor

-Selectarea culorilor

-Selectarea fondurilor

-Selectarea funcțiilor de tiparire la imprimanta.

Problema 1 - Program Inchirieri

Form1

Public try As Integer

Private Sub Command1_Click()

If Form1.Text1.Text = 'admin' And Form1.Text2.Text = 'admin' Then

Form2.Show

Form1.Hide

Else

GoTo check

End If

Exit Sub

check:

For i = o To Form3.lstnume.ListCount - 1

If Form3.lstnume.List(i) = Form1.Text1.Text And Form3.lstparole.List(i) = Form1.Text2.Text Then

If opt1.Value = True Then

Form2.Show

Form1.Hide

ElseIf opt2.Value = True Then

Form2.mnutext.Enabled = False

Form2.mnuimg.Enabled = False

Form2.mnuparole.Enabled = False

Form2.cmdadd.Enabled = False

Form2.tbrparole.Enabled = False

Form2.tbrimg.Enabled = False

Form2.tbrtxt.Enabled = False

Form2.Show

Form1.Hide

Else

GoTo sel

End If

ElseIf i = Form3.lstnume.ListCount - 1 Then

GoTo pas

End If

Next i

Exit Sub

pas:

try = try - 1

Form1.Label4.Caption = try

If try = 0 Then

Form1.Command1.Enabled = False

Form1.Text1.Enabled = False

Form1.Text2.Enabled = False

Form1.opt1.Enabled = False

Form1.opt2.Enabled = False

End If

Exit Sub

sel:

MsgBox 'Selectati nivelul de acces.', , 'Nivel acces'

End Sub

Private Sub Form_Load()

try = 3

Form1.Label4.Caption = try

Open Form4.Dir1.Path & 'id.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Form3.lstnume.AddItem (Data)

EOF (1)

Loop

Close #1

Open Form4.Dir1.Path & 'pass.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Form3.lstparole.AddItem (Data)

EOF (1)

Loop

Close #1

Open Form4.Dir1.Path + 'setarisetari_forma1_label.txt' For Input As #1

Input #1, Data

lblfirma.Caption = Data

Close #1

Open Form4.Dir1.Path + 'setarisetari_forma1_imagine.txt' For Input As #1

Input #1, Data

If Data <> '-' Then

Image1 = LoadPicture(Data)

End If

Close #1

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Form2

Private Sub cmdadd_Click()

Form11.Show

End Sub

Private Sub cmdcasinch_Click()

mnucaseteinch_Click

End Sub

Private Sub cmdcasreturn_Click()

mnucasetedereturn_Click

End Sub

Private Sub cmdrent_Click()

Open Form4.Dir1.Path + 'clientirestante' + InputBox('Introduceti CNP-ul clientului', 'Inchiriere') + '.txt' For Append As #1

Print #1, List1.List(List1.ListIndex)

Close #1

cmdrent.Visible = False

List2.AddItem (List1.List(List1.ListIndex))

End Sub

Private Sub Combo1_Click()

Select Case Combo1.ListIndex

Case 0:

List1.Clear

Open Form4.Dir1.Path + 'caseteactiune.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Case 1:

List1.Clear

Open Form4.Dir1.Path + 'caseteanimatie.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Case 2:

List1.Clear

Open Form4.Dir1.Path + 'caseteaventura.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Case 3:

List1.Clear

Open Form4.Dir1.Path + 'casetecomedie.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Case 4:

List1.Clear

Open Form4.Dir1.Path + 'casetesci-fi.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Case 5:

List1.Clear

Open Form4.Dir1.Path + 'caseteactiune.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Open Form4.Dir1.Path + 'caseteanimatie.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Open Form4.Dir1.Path + 'caseteaventura.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Open Form4.Dir1.Path + 'casetecomedie.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

Open Form4.Dir1.Path + 'casetesci-fi.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

Loop

Close #1

End Select

List1.Refresh

End Sub

Private Sub Form_Load()

Open Form4.Dir1.Path + 'casetereturn.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List2.AddItem (Data)

EOF (1)

Loop

Close #1

End Sub

Private Sub Form_Unload(Cancel As Integer)

Open Form4.Dir1.Path + 'casetereturn.txt' For Output As #1

For i = 0 To List2.ListCount - 1

Print #1, List2.List(i)

Next i

Close #1

End

End Sub

Private Sub List1_Click()

On Error Resume Next

Dim img As String

Text2.Text = Empty

Text3.Text = Empty

Open Form4.Dir1.Path + 'casetefilme' + 'actori_' + List1.List(i) + '.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Text1.Text = Text1.Text + Data + vbNewLine

EOF (1)

Loop

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'rezumat_' + List1.List(i) + '.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Text2.Text = Text2.Text + Data + vbNewLine

EOF (1)

Loop

Close #1

img = Form4.Dir1.Path + 'setariimg_' + List1.List(i) + '.txt'

Image1.Picture = LoadPicture(img)

Image1.Refresh

End Sub

Private Sub mnucasetedereturn_Click()

Form10.Caption = 'Casete de returnat'

Form10.Show

End Sub

Private Sub mnucaseteinch_Click()

Form10.Caption = 'Casete inchiriate'

Form10.Show

End Sub

Private Sub mnuclienti_Click()

Form12.Show

End Sub

Private Sub mnuimg_Click()

Form6.Show

End Sub

Private Sub mnuinch_Click()

Form8.Show

End Sub

Private Sub mnuparole_Click()

Form3.lstnume.Clear

Form3.lstparole.Clear

Open Form4.Dir1.Path & 'id.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Form3.lstnume.AddItem (Data)

EOF (1)

Loop

Close #1

Open Form4.Dir1.Path & 'pass.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Form3.lstparole.AddItem (Data)

EOF (1)

Loop

Close #1

Form3.Show

End Sub

Private Sub mnuregclient_Click()

Form7.Show

End Sub

Private Sub mnureturn_Click()

Form9.Show

End Sub

Private Sub mnutext_Click()

Form5.Show

End Sub

Private Sub tbrclienti_Click()

mnuclienti_Click

End Sub

Private Sub tbrimg_Click()

mnuimg_Click

End Sub

Private Sub tbrinch_Click()

mnuinch_Click

End Sub

Private Sub tbrinreg_Click()

mnuregclient_Click

End Sub

Private Sub tbrparole_Click()

mnuparole_Click

End Sub

Private Sub tbrreturn_Click()

mnureturn_Click

End Sub

Private Sub tbrtxt_Click()

mnutext_Click

End Sub

Form3

Private Sub cmdmod_Click()

lstnume.List(lstnume.ListIndex) = Text3.Text

lstparole.List(lstparole.ListIndex) = Text4.Text

Label5.Visible = False

Label6.Visible = False

Text3.Visible = False

Text4.Visible = False

cmdmod.Visible = False

End Sub

Private Sub cmdmodif_Click()

Label5.Visible = True

Label6.Visible = True

Text3.Visible = True

Text4.Visible = True

cmdmod.Visible = True

Text3.Text = lstnume.List(lstnume.ListIndex)

Text4.Text = lstparole.List(lstparole.ListIndex)

End Sub

Private Sub Command1_Click()

lstnume.AddItem (Text1.Text)

lstparole.AddItem (Text2.Text)

Text1.Text = Empty

Text2.Text = Empty

End Sub

Private Sub Command2_Click()

lstnume.RemoveItem (lstnume.ListIndex)

lstparole.RemoveItem (lstparole.ListIndex)

End Sub

Private Sub Form_Unload(Cancel As Integer)

Open Form4.Dir1.Path + 'id.txt' For Output As #1

For i = 0 To lstnume.ListCount - 1

Print #1, lstnume.List(i)

Next i

Close #1

Open Form4.Dir1.Path + 'pass.txt' For Output As #1

For i = 0 To lstparole.ListCount - 1

Print #1, lstparole.List(i)

Next i

Close #1

Form3.Hide

End Sub

Private Sub lstnume_Click()

lstparole.ListIndex = lstnume.ListIndex

cmdmodif.Enabled = True

End Sub

Private Sub lstparole_Click()

lstnume.ListIndex = lstparole.ListIndex

cmdmodif.Enabled = True

End Sub

Form4

Form5

Private Sub cmdupdate_Click()

Form1.lblfirma.Caption = Text1.Text

Open Form4.Dir1.Path + 'setarisetari_forma1_label.txt' For Output As #1

Print #1, Text1.Text

Close #1

End Sub

Private Sub Form_Unload(Cancel As Integer)

Form5.Hide

End Sub

Private Sub Text1_Change()

cmdupdate.Enabled = True

End Sub

Form6

Public fileloc As String

Private Sub cmdopen_Click()

comdl.ShowOpen

fileloc = comdl.FileName

Text1.Text = fileloc

End Sub

Private Sub cmdupdate_Click()

On Error Resume Next

Form1.Image1 = LoadPicture(fileloc)

Open Form4.Dir1.Path + 'setarisetari_forma1_imagine.txt' For Output As #1

Print #1, Text1.Text

Close #1

End Sub

Private Sub Form_Unload(Cancel As Integer)

Form6.Hide

End Sub

Private Sub Text1_Change()

cmdupdate.Enabled = True

End Sub

Form7

Private Sub cmdreg_Click()

If Text1.Text <> '' And Text2.Text <> '' And Text3.Text <> '' Then

lstcod.AddItem (lstcod.ListCount)

MsgBox 'Numarul de legitimatie al clientului este:' & lstcod.ListCount - 1, vbInformation, ' '

Open Form4.Dir1.Path + 'clienti' + Text2.Text + '.txt' For Output As #1

Print #1, Text1.Text + vbNewLine + Text2.Text + vbNewLine + Text3.Text

Close #1

Open Form4.Dir1.Path + 'setaricod.txt' For Output As #1

For i = 0 To lstcod.ListCount - 1

Print #1, lstcod.List(1)

Next i

Close #1

Open Form4.Dir1.Path + 'clienticlienti.txt' For Append As #1

Print #1, Text1.Text + vbNewLine

Close #1

Open Form4.Dir1.Path + 'clienticnp.txt' For Append As #1

Print #1, Text2.Text + vbNewLine

Close #1

End If

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

End Sub

Private Sub Form_Load()

Open Form4.Dir1.Path + 'setaricod.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Form7.lstcod.AddItem (Data)

EOF (1)

Loop

Close #1

End Sub

Private Sub Form_Unload(Cancel As Integer)

Unload Me

End Sub

Private Sub Text1_Change()

cmdreg.Enabled = True

End Sub

Private Sub Text2_Change()

cmdreg.Enabled = True

End Sub

Private Sub Text3_Change()

cmdreg.Enabled = True

End Sub

Form8

Private Sub cmdcheck_Click()

List1.Clear

Open Form4.Dir1.Path + 'clienticnp.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

EOF (1)

Loop

Close #1

For i = 0 To List1.ListCount - 1

If Text2.Text = List1.List(i) Then

cnpcurent = List1.List(i)

Form2.cmdrent.Visible = True

Unload Me

Exit Sub

ElseIf i = List1.ListCount - 1 Then

GoTo gresit

End If

Next i

Exit Sub

gresit:

MsgBox 'Numar incorect sau client neinregistrat', , 'Eroare'

End Sub

Form9

Private Sub cmdviewcas_Click()

On Error GoTo gresit

Open Form4.Dir1.Path + 'clientirestante' + InputBox('Introduceti CNP-ul clientului', 'Verificare client') + '.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

EOF (1)

Loop

Close #1

Exit Sub

gresit:

MsgBox 'Client neinregistrat sau CNP gresit', , 'Eroare'

End Sub

Private Sub Command1_Click()

List1.RemoveItem (List1.ListIndex)

If List1.ListCount <> 0 Then

Open Form4.Dir1.Path + 'clientirestante' + InputBox('Introduceti CNP-ul clientului', 'Verificare client') + '.txt' For Output As #1

For i = 0 To List1.ListCount - 1

Print #1, List1.List(i)

Next i

Close #1

Else

Open Form4.Dir1.Path + 'clientirestante' + InputBox('Introduceti CNP-ul clientului', 'Verificare client') + '.txt' For Output As #1

Print #1, ' '

Close #1

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

Open Form4.Dir1.Path + 'clientirestante' + cnpcurent + '.txt' For Output As #1

For i = 0 To List1.ListCount - 1

Print #1, List1.List(i) + vbNewLine

Next i

Close #1

cnpcurent = Empty

Unload Me

End Sub

Private Sub List1_Click()

Command1.Enabled = True

End Sub

Form10

Private Sub cmdview_Click()

For i = 0 To Form2.List2.ListCount - 1

List1.AddItem (Form2.List2.List(i))

Next i

End Sub

Form11

Public loc As String

Private Sub cmdadauga_Click()

If Text1.Text = 'actiune' Then

Open Form4.Dir1.Path + 'caseteactiune.txt' For Append As #1

Print #1, Text2.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'actori_' + Text2.Text + '.txt' For Output As #1

Print #1, Text3.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'rezumat_' + Text2.Text + '.txt' For Output As #1

Print #1, Text4.Text

Close #1

Open Form4.Dir1.Path + 'setariimg_' + Text2.Text + '.txt' For Output As #1

Print #1, Text5.Text

Close #1

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

Text4.Text = Empty

Text5.Text = Empty

ElseIf Text1.Text = 'animatie' Then

Open Form4.Dir1.Path + 'caseteanimatie.txt' For Append As #1

Print #1, Text2.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'actori_' + Text2.Text + '.txt' For Output As #1

Print #1, Text3.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'rezumat_' + Text2.Text + '.txt' For Output As #1

Print #1, Text4.Text

Close #1

Open Form4.Dir1.Path + 'setariimg_' + Text2.Text + '.txt' For Output As #1

Print #1, Text5.Text

Close #1

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

Text4.Text = Empty

Text5.Text = Empty

ElseIf Text1.Text = 'aventura' Then

Open Form4.Dir1.Path + 'caseteaventura.txt' For Append As #1

Print #1, Text2.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'actori_' + Text2.Text + '.txt' For Output As #1

Print #1, Text3.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'rezumat_' + Text2.Text + '.txt' For Output As #1

Print #1, Text4.Text

Close #1

Open Form4.Dir1.Path + 'setariimg_' + Text2.Text + '.txt' For Output As #1

Print #1, Text5.Text

Close #1

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

Text4.Text = Empty

Text5.Text = Empty

ElseIf Text1.Text = 'comedie' Then

Open Form4.Dir1.Path + 'casetecomedie.txt' For Append As #1

Print #1, Text2.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'actori_' + Text2.Text + '.txt' For Output As #1

Print #1, Text3.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'rezumat_' + Text2.Text + '.txt' For Output As #1

Print #1, Text4.Text

Close #1

Open Form4.Dir1.Path + 'setariimg_' + Text2.Text + '.txt' For Output As #1

Print #1, Text5.Text

Close #1

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

Text4.Text = Empty

Text5.Text = Empty

ElseIf Text1.Text = 'sci-fi' Then

Open Form4.Dir1.Path + 'casetesci-fi.txt' For Append As #1

Print #1, Text2.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'actori_' + Text2.Text + '.txt' For Output As #1

Print #1, Text3.Text

Close #1

Open Form4.Dir1.Path + 'casetefilme' + 'rezumat_' + Text2.Text + '.txt' For Output As #1

Print #1, Text4.Text

Close #1

Open Form4.Dir1.Path + 'setariimg_' + Text2.Text + '.txt' For Output As #1

Print #1, Text5.Text

Close #1

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

Text4.Text = Empty

Text5.Text = Empty

Else

MsgBox 'Introduceti o categorie din cele afisate.', , 'Eroare'

End If

End Sub

Private Sub cmdselect_Click()

comdl.ShowOpen

loc = comdl.FileName

Text5.Text = loc

End Sub

Private Sub Form_Unload(Cancel As Integer)

Hide

End Sub

Form12

Private Sub cmdview_Click()

Text1.Text = Empty

Open Form4.Dir1.Path + 'clienticlienti.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

Text1.Text = Text1.Text + Data + vbNewLine

EOF (1)

Loop

Close #1

End Sub

Problema 2 - Editor texte

frmLogin

Private Sub cmdOK_Click()

If txt1.Text = 'editor' And txt2.Text = 'rau' Then

If Option1.Value = True Then

Me.Hide

Form1.Show

ElseIf Option2.Value = True Then

Form1.cmdcolfundal.Enabled = False

Me.Hide

Form1.Show

Else

MsgBox 'Selectati un nivel de acces', , 'Nivel acces'

End If

Else

MsgBox 'Nume sau parola gresite', , 'Accesare'

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Form1

Dim fileloc As String

Private Sub cmdadd_Click()

Dim add As String

If fileloc <> '' Then

add = vbNewLine & '> > > Adaugat la:' & Date & ' - ' & Time & vbNewLine

Open fileloc For Append As #1

Print #1, add

Print #1, txt.Text

Close #1

Else

MsgBox 'Selectati intai fisierul de lucru!', vbExclamation, 'Fisier neselctat!'

End If

End Sub

Private Sub cmdb_Click()

If txt.FontBold = True Then

txt.FontBold = False

Else

txt.FontBold = True

End If

End Sub

Private Sub cmdcolfundal_Click()

comdl.ShowColor

txt.BackColor = comdl.Color

End Sub

Private Sub cmdempty_Click()

fileloc = ''

txt.Text = Empty

End Sub

Private Sub cmdfontcolor_Click()

comdl.ShowColor

txt.ForeColor = comdl.Color

End Sub

Private Sub cmdopen_Click()

On Error Resume Next

If fileloc <> '' Then

Open fileloc For Input As #2

Do Until EOF(2)

Input #2, Data

txt.Text = txt.Text + Data + vbNewLine

EOF (2)

Loop

Close #2

Else

MsgBox 'Selectati intai fisierul de lucru!', vbExclamation, 'Fisier neselctat!'

End If

End Sub

Private Sub cmdsave_Click()

On Error Resume Next

If fileloc <> '' Then

Open fileloc For Output As #3

Print #3, txt.Text

Close #3

Else

comdl.ShowSave

fileloc = comdl.FileName

Open fileloc For Output As #3

Print #3, txt.Text

Close #3

End If

End Sub

Private Sub cmdselect_Click()

comdl.ShowOpen

fileloc = comdl.FileName

End Sub

Private Sub cmdi_Click()

If txt.FontItalic = True Then

txt.FontItalic = False

Else

txt.FontItalic = True

End If

End Sub

Private Sub cmdss_Click()

If txt.FontStrikethru = True Then

txt.FontStrikethru = False

Else

txt.FontStrikethru = True

End If

End Sub

Private Sub cmdu_Click()

If txt.FontUnderline = True Then

txt.FontUnderline = False

Else

txt.FontUnderline = True

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Problema 3 - Cronometru

frmLogin

Private Sub cmdOK_Click()

If txt1.Text = 'cronometru' And txt2.Text = 'rau' Then

If Option1.Value = True Then

Me.Hide

Form1.Show

ElseIf Option2.Value = True Then

Form1.cmdmem.Enabled = False

Form1.cmdview.Enabled = False

Else

MsgBox 'Selectati un nivel de acces', , 'Nivel acces neselectat'

End If

Else

MsgBox 'Nume sau parola gresite', , 'Eroare'

End If

End Sub

Form1

Public ms As Long

Public s As Long

Public m As Long

Public h As Long

Private Sub cmdmem_Click()

Form2.List1.AddItem (lblh.Caption + 'h: ' + lblm.Caption + 'm: ' + lbls.Caption + ',' + lblms.Caption + 's')

End Sub

Private Sub cmdreset_Click()

tmrms.Enabled = False

tmrs.Enabled = False

tmrm.Enabled = False

ms = 0

s = 0

m = 0

h = 0

lblms.Caption = '00'

lbls.Caption = '00'

lblm.Caption = '00'

lblh.Caption = '00'

End Sub

Private Sub cmdstart_Click()

tmrms.Enabled = True

tmrs.Enabled = True

tmrm.Enabled = True

End Sub

Private Sub cmdstop_Click()

tmrms.Enabled = False

tmrs.Enabled = False

tmrm.Enabled = False

Form2.List1.AddItem (lblh.Caption + 'h: ' + lblm.Caption + 'm: ' + lbls.Caption + ',' + lblms.Caption + 's')

End Sub

Private Sub cmdview_Click()

Form2.Show

End Sub

Private Sub Command1_Click()

End

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Private Sub tmrm_Timer()

m = m + 1

If m <= 9 Then

lblm.Caption = '0' & m

Else

lblm.Caption = m

End If

If m = 60 Then

m = 0

lblm.Caption = '00'

h = h + 1

End If

If h <= 9 Then

lblh.Caption = '0' & h

Else

lblh.Caption = h

End If

If h = 24 Then

h = 0

lblh.Caption = '00'

End If

End Sub

Private Sub tmrms_Timer()

ms = ms + 1

If ms <= 9 Then

lblms.Caption = '0' & ms

Else

lblms.Caption = ms

End If

If ms = 100 Then

ms = 0

lblms.Caption = '00'

End If

End Sub

Private Sub tmrs_Timer()

s = s + 1

If s <= 9 Then

lbls.Caption = '0' & s

Else

lbls.Caption = s

End If

If s = 60 Then

s = 0

lbls.Caption = '00'

End If

End Sub

Form2

Problema 4 - App3

frmLogin

Private Sub cmdOK_Click()

If txt1.Text = 'app3' And txt2.Text = 'rau' Then

If Option1.Value = True Then

Me.Hide

Form1.Show

ElseIf Option2.Value = True Then

Form1.Option2.Enabled = False

Else

MsgBox 'Selectati un nivel de acces', , 'Nivel acces incorect'

End If

Else

MsgBox 'Nume sau parola gresite', , 'Accesare'

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Form1

Private Sub cmdempty_Click()

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

End Sub

Private Sub cmdexe_Click()

On Error Resume Next

If Option1.Value = True Then

Text3.Text = Val(Text1.Text) + Val(Text2.Text)

List1.AddItem (Label1.Caption & ' / ' & Label2.Caption & ' >> ' & Text1.Text & ' adunat cu ' & Text2.Text & ' = ' & Text3.Text)

ElseIf Option2.Value = True Then

Text3.Text = Text1.Text & ' ' & Text2.Text

List1.AddItem (Label1.Caption & ' / ' & Label2.Caption & ' >> ' & Text1.Text & ' concatenat cu ' & Text2.Text & ' = ' & Text3.Text)

ElseIf Option3.Value = True Then

Text3.Text = Val(Text1.Text) - Val(Text2.Text)

List1.AddItem (Label1.Caption & ' / ' & Label2.Caption & ' >> ' & Text2.Text & ' scazut din ' & Text1.Text & ' = ' & Text3.Text)

ElseIf Option4.Value = True Then

Text3.Text = Val(Text1.Text) * Val(Text2.Text)

List1.AddItem (Label1.Caption & ' / ' & Label2.Caption & ' >> ' & Text1.Text & ' inmultit cu ' & Text2.Text & ' = ' & Text3.Text)

ElseIf Option5.Value = True Then

Text3.Text = Val(Text1.Text) / Val(Text2.Text)

List1.AddItem (Label1.Caption & ' / ' & Label2.Caption & ' >> ' & Text1.Text & ' impartit la ' & Text2.Text & ' = ' & Text3.Text)

End If

Label4.Caption = ' ' & Label1.Caption & ' / ' & Label2.Caption

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Private Sub Timer1_Timer()

Label1.Caption = Time

Label2.Caption = Date

End Sub

Problema 5 - Lista Produse

frmLogin

Private Sub cmdOK_Click()

If txt1.Text = 'lista' And txt2.Text = 'rau' Then

If Option1.Value = True Then

Me.Hide

Form1.Show

ElseIf Option2.Value = True Then

Form1.cmdremove.Visible = False

Me.Hide

Form1.Show

Else

MsgBox 'Selectati un nivel de acces', , 'Nivel acces'

End If

Else

MsgBox 'Nume sau parola gresite', , 'Login'

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Form1

Private Sub cmdadd_Click()

For i = 0 To List3.ListCount - 1

If Text3.Text = List3.List(i) Then

Open Dir1.Path + 'produse_' + Text3.Text + '.txt' For Append As #1

Print #1, Text1.Text

Close #1

Open Dir1.Path + 'pret_' + Text3.Text + '.txt' For Append As #1

Print #1, Text2.Text

Close #1

ElseIf i = List3.ListCount - 1 Then

List3.AddItem (Text3.Text)

Open Dir1.Path + 'produse_' + Text3.Text + '.txt' For Append As #1

Print #1, Text1.Text

Close #1

Open Dir1.Path + 'pret_' + Text3.Text + '.txt' For Append As #1

Print #1, Text2.Text

Close #1

End If

Next i

Text1.Text = Empty

Text2.Text = Empty

Text3.Text = Empty

cmdadd.Enabled = False

End Sub

Private Sub cmdmod_Click()

If Text4.Visible = False Then

Text4.Visible = True

Text5.Visible = True

Label5.Visible = True

Label6.Visible = True

cmdmod.Caption = 'Aplica modificarile'

Else

Text4.Visible = False

Text5.Visible = False

Label5.Visible = False

Label6.Visible = False

cmdmod.Caption = 'Modifica'

List1.List(List1.ListIndex) = Text4.Text

List2.List(List2.ListIndex) = Text5.Text

Open Dir1.Path + 'produse_' + List3.List(List3.ListIndex) + '.txt' For Output As #1

For i = 0 To List1.ListCount - 1

Print #1, List1.List(i)

Next i

Close #1

Open Dir1.Path + 'pret_' + List3.List(List3.ListIndex) + '.txt' For Output As #1

For i = 0 To List2.ListCount - 1

Print #1, List2.List(i)

Next i

Close #1

End If

End Sub

Private Sub cmdremove_Click()

List1.RemoveItem (List1.ListIndex)

List2.RemoveItem (List2.ListIndex)

cmdremove.Enabled = False

End Sub

Private Sub Form_Load()

On Error GoTo iesire

Open Dir1.Path + 'categorii.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List3.AddItem (Data)

EOF (1)

Loop

Close #1

Exit Sub

iesire:

End Sub

Private Sub Form_Unload(Cancel As Integer)

Open Dir1.Path + 'categorii.txt' For Output As #1

For i = 0 To List3.ListCount - 1

Print #1, List3.List(i)

Next i

Close #1

End

End Sub

Private Sub List1_Click()

List2.ListIndex = List1.ListIndex

cmdremove.Enabled = True

Text4.Text = List1.List(List1.ListIndex)

Text5.Text = List2.List(List2.ListIndex)

End Sub

Private Sub List2_Click()

List1.ListIndex = List2.ListIndex

cmdremove.Enabled = True

Text4.Text = List1.List(List1.ListIndex)

Text5.Text = List2.List(List2.ListIndex)

End Sub

Private Sub List3_Click()

List1.Clear

List2.Clear

Open Dir1.Path + 'produse_' + List3.List(List3.ListIndex) + '.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List1.AddItem (Data)

EOF (1)

Loop

Close #1

Open Dir1.Path + 'pret_' + List3.List(List3.ListIndex) + '.txt' For Input As #1

Do Until EOF(1)

Input #1, Data

List2.AddItem (Data)

EOF (1)

Loop

Close #1

End Sub

Private Sub Text1_Change()

cmdadd.Enabled = True

End Sub

Private Sub Text2_Change()

cmdadd.Enabled = True

End Sub

Problema 6 - Calculator

frmLogin

Private Sub cmdOK_Click()

If txt1.Text = 'calculator' And txt2.Text = 'rau' Then

If Option1.Value = True Then

Me.Hide

Form1.Show

ElseIf Option2.Value = True Then

Form1.mnu.Enabled = False

Me.Hide

Form1.Show

Else

MsgBox 'Selectati nivelul de acces', , 'Nivel acces'

End If

Else

MsgBox 'Nume sau parola gresite.', , 'Accesare'

End If

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Form1

Option Explicit

Public var1 As Double

Public var2 As String

Public var3 As String

Public var4 As Double

Public var5 As String

Public var6 As String

Private Sub cmd1_Click()

unu

txt1.SetFocus

End Sub

Private Sub cmd10_Click()

zero

txt1.SetFocus

End Sub

Private Sub cmd11_Click()

egal

txt1.SetFocus

End Sub

Private Sub cmd12_Click()

plus

txt1.SetFocus

End Sub

Private Sub cmd13_Click()

minus

txt1.SetFocus

End Sub

Private Sub cmd14_Click()

inmultit

txt1.SetFocus

End Sub

Private Sub cmd15_Click()

impartit

txt1.SetFocus

End Sub

Private Sub cmd16_Click()

virgula

txt1.SetFocus

End Sub

Private Sub cmd17_Click()

clear

txt1.SetFocus

End Sub

Private Sub cmd2_Click()

doi

txt1.SetFocus

End Sub

Private Sub cmd3_Click()

trei

txt1.SetFocus

End Sub

Private Sub cmd4_Click()

patru

txt1.SetFocus

End Sub

Private Sub cmd5_Click()

cinci

txt1.SetFocus

End Sub

Private Sub cmd6_Click()

sase

txt1.SetFocus

End Sub

Private Sub cmd7_Click()

sapte

txt1.SetFocus

End Sub

Private Sub cmd8_Click()

opt

txt1.SetFocus

End Sub

Private Sub cmd9_Click()

noua

txt1.SetFocus

End Sub

Private Sub cmdce_Click()

CE

txt1.SetFocus

End Sub

Private Sub cmdm_Click()

Mplus

txt1.SetFocus

End Sub

Private Sub cmdmc_Click()

MC

txt1.SetFocus

End Sub

Private Sub cmdmr_Click()

MR

txt1.SetFocus

End Sub

Private Sub cmdms_Click()

MS

txt1.SetFocus

End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyReturn Then

egal

ElseIf KeyCode = vbKeyL And Shift = 2 Then

MC

ElseIf KeyCode = vbKeyR And Shift = 2 Then

MR

ElseIf KeyCode = vbKeyM And Shift = 2 Then

MS

ElseIf KeyCode = vbKeyP And Shift = 2 Then

Mplus

End If

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)

If KeyAscii = 43 Then

plus

ElseIf KeyAscii = 45 Then

minus

ElseIf KeyAscii = 42 Then

inmultit

ElseIf KeyAscii = 47 Then

impartit

ElseIf KeyAscii = 49 Then

unu

ElseIf KeyAscii = 50 Then

doi

ElseIf KeyAscii = 51 Then

trei

ElseIf KeyAscii = 52 Then

patru

ElseIf KeyAscii = 53 Then

cinci

ElseIf KeyAscii = 54 Then

sase

ElseIf KeyAscii = 55 Then

sapte

ElseIf KeyAscii = 56 Then

opt

ElseIf KeyAscii = 57 Then

noua

ElseIf KeyAscii = 48 Then

zero

ElseIf KeyAscii = 46 Then

virgula

ElseIf KeyAscii = 127 Then

CE

ElseIf KeyAscii = 27 Then

clear

End If

End Sub

Private Sub Form_Load()

txt1.Text = Empty

var1 = Empty

var2 = ''

var3 = ''

var4 = Empty

var5 = ''

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Private Sub mnugol_Click()

If lst1.ListCount > 0 Then

lst1.clear

Else

End If

End Sub

Private Sub mnulista_Click()

If mnulista.Checked = False Then

mnulista.Checked = True

Form1.Width = 7200

mnuoptlista.Enabled = True

Else

mnulista.Checked = False

Form1.Width = 3225

mnuoptlista.Enabled = False

End If

End Sub

Public Sub egal()

On Error GoTo eroare1

If var3 = '+' Then

var1 = txt1.Text + var1

var5 = var5 + ' + ' + txt1.Text + ' =' + Str(var1)

ElseIf var3 = '-' Then

var1 = var1 - txt1.Text

var5 = var5 + ' - ' + txt1.Text + ' =' + Str(var1)

ElseIf var3 = '*' Then

var1 = var1 * txt1.Text

var5 = var5 + ' * ' + txt1.Text + ' =' + Str(var1)

ElseIf var3 = '/' Then

var1 = var1 / txt1.Text

var5 = var5 + ' / ' + txt1.Text + ' =' + Str(var1)

Else

var1 = Empty

var2 = ''

var3 = ''

End If

txt1.Text = Empty

txt1.Text = var1

lst1.AddItem (var5)

var1 = Empty

var2 = '='

var3 = ''

var5 = ''

Exit Sub

eroare1:

txt1.Text = 'Nu se poate imparti la 0'

End Sub

Public Sub plus()

On Error GoTo eroare1

If var3 = '+' Then

var1 = txt1.Text + var1

var5 = var5 + ' + ' + txt1.Text

ElseIf var3 = '-' Then

var1 = var1 - txt1.Text

var5 = var5 + ' - ' + txt1.Text

ElseIf var3 = '*' Then

var1 = var1 * txt1.Text

var5 = var5 + ' * ' + txt1.Text

ElseIf var3 = '/' Then

var1 = var1 / txt1.Text

var5 = var5 + ' / ' + txt1.Text

Else

var1 = txt1.Text + var1

var5 = txt1.Text

End If

txt1.Text = Empty

txt1.Text = var1

var2 = '+'

Exit Sub

eroare1:

txt1.Text = 'Nu se poate imparti la 0'

End Sub

Public Sub minus()

On Error GoTo eroare1

If var3 = '+' Then

var1 = txt1.Text + var1

var5 = var5 + ' + ' + txt1.Text

ElseIf var3 = '-' Then

var1 = var1 - txt1.Text

var5 = var5 + ' - ' + txt1.Text

ElseIf var3 = '*' Then

var1 = var1 * txt1.Text

var5 = var5 + ' * ' + txt1.Text

ElseIf var3 = '/' Then

var1 = var1 / txt1.Text

var5 = var5 + ' / ' + txt1.Text

Else

var1 = txt1.Text - var1

var5 = txt1.Text

End If

txt1.Text = Empty

txt1.Text = var1

var2 = '-'

Exit Sub

eroare1:

txt1.Text = 'Nu se poate imparti la 0'

End Sub

Public Sub inmultit()

On Error GoTo eroare1

If var3 = '+' Then

var1 = txt1.Text + var1

var5 = '(' + var5 + ' + ' + txt1.Text + ')'

ElseIf var3 = '-' Then

var1 = var1 - txt1.Text

var5 = '(' + var5 + ' - ' + txt1.Text + ')'

ElseIf var3 = '*' Then

var1 = var1 * txt1.Text

var5 = var5 + ' * ' + txt1.Text

ElseIf var3 = '/' Then

var1 = var1 / txt1.Text

var5 = var5 + ' / ' + txt1.Text

Else

var1 = txt1.Text * 1

var5 = txt1.Text

End If

txt1.Text = Empty

txt1.Text = var1

var2 = '*'

Exit Sub

eroare1:

txt1.Text = 'Nu se poate imparti la 0'

End Sub

Public Sub impartit()

On Error GoTo eroare1

If var3 = '+' Then

var1 = txt1.Text + var1

var5 = '(' + var5 + ' + ' + txt1.Text + ')'

ElseIf var3 = '-' Then

var1 = var1 - txt1.Text

var5 = '(' + var5 + ' - ' + txt1.Text + ')'

ElseIf var3 = '*' Then

var1 = var1 * txt1.Text

var5 = var5 + ' * ' + txt1.Text

ElseIf var3 = '/' Then

var1 = var1 / txt1.Text

var5 = var5 + ' / ' + txt1.Text

Else

var1 = txt1.Text / 1

var5 = txt1.Text

End If

txt1.Text = Empty

txt1.Text = var1

var2 = '/'

Exit Sub

eroare1:

txt1.Text = 'Nu se poate imparti la 0'

End Sub

Public Sub unu()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '1'

Else

txt1.Text = txt1.Text + '1'

End If

End Sub

Public Sub doi()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '2'

Else

txt1.Text = txt1.Text + '2'

End If

End Sub

Public Sub trei()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '3'

Else

txt1.Text = txt1.Text + '3'

End If

End Sub

Public Sub patru()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '4'

Else

txt1.Text = txt1.Text + '4'

End If

End Sub

Public Sub cinci()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '5'

Else

txt1.Text = txt1.Text + '5'

End If

End Sub

Public Sub sase()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '6'

Else

txt1.Text = txt1.Text + '6'

End If

End Sub

Public Sub sapte()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '7'

Else

txt1.Text = txt1.Text + '7'

End If

End Sub

Public Sub opt()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '8'

Else

txt1.Text = txt1.Text + '8'

End If

End Sub

Public Sub noua()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '9'

Else

txt1.Text = txt1.Text + '9'

End If

End Sub

Public Sub zero()

If var2 <> '' Then

txt1.Text = Empty

var3 = var2

var2 = ''

txt1.Text = txt1.Text + '0'

Else

txt1.Text = txt1.Text + '0'

End If

End Sub

Public Sub virgula()

If txt1.Text <> Empty Then

txt1.Text = txt1.Text + ','

Else

txt1.Text = Empty

End If

End Sub

Public Sub CE()

txt1.Text = ''

End Sub

Public Sub clear()

txt1.Text = Empty

var1 = Empty

var2 = ''

var3 = ''

var5 = ''

End Sub

Public Sub MC()

var4 = Empty

lblm.Caption = ''

End Sub

Public Sub MR()

If var4 <> Empty Then

txt1.Text = var4

var3 = var2

var2 = ''

End If

End Sub

Public Sub MS()

var4 = txt1.Text

lblm = 'M'

var2 = 'M'

End Sub

Public Sub Mplus()

If txt1.Text <> '' Then

var4 = var4 + txt1.Text

lblm.Caption = 'M'

var2 = 'M'

Else

var4 = txt1.Text

lblm.Caption = 'M'

var2 = 'M'

End If

End Sub

Problema 7 - Analizator text

frmLogin

Private Sub cmdOK_Click()

If txt1.Text = 'analizator' And txt2.Text = 'rau' Then

If Option1.Value = True Then

Me.Hide

Form1.Show

ElseIf Option2.Value = True Then

Form1.cmdopen.Enabled = False

Me.Hide

Form1.Show

Else

MsgBox 'Selectati nivelul de acces', , 'Nivel acces'

End If

Else

MsgBox 'Nume sau parola gresite', , 'Eroare'

End If

End Sub

Form1

Public cuvtot As Long

Public cuv As String

Public proptot As Long

Public prop As String

Private Sub cmdanaliza_Click()

Dim sir As String

cuvtot = 0

proptot = 0

sir = txt.Text

For i = 1 To Len(sir)

If Mid(sir, i, 1) = ' ' Or Mid(sir, i, 1) = ',' Or Mid(sir, i, 1) = ';' Then

cuvtot = cuvtot + 1

ElseIf Mid(sir, i, 1) = '.' Or Mid(sir, i, 1) = '?' Or Mid(sir, i, 1) = '!' Or Mid(sir, i, 1) = ':' Then

proptot = proptot + 1

cuvtot = cuvtot + 1

End If

Next i

lblcar = Len(txt.Text)

lblcuv = cuvtot

lblprop = proptot

End Sub

Private Sub cmdopen_Click()

On Error GoTo eroare

Dim fileloc As String

comdl.ShowOpen

fileloc = comdl.FileName

Open fileloc For Input As #1

Do Until EOF(1)

Input #1, Data

txt.Text = txt.Text + Data + vbNewLine

EOF (1)

Loop

Close #1

Exit Sub

eroare:

End Sub


Document Info


Accesari: 2775
Apreciat: hand-up

Comenteaza documentul:

Nu esti inregistrat
Trebuie sa fii utilizator inregistrat pentru a putea comenta


Creaza cont nou

A fost util?

Daca documentul a fost util si crezi ca merita
sa adaugi un link catre el la tine in site


in pagina web a site-ului tau.




eCoduri.com - coduri postale, contabile, CAEN sau bancare

Politica de confidentialitate | Termenii si conditii de utilizare




Copyright © Contact (SCRIGROUP Int. 2024 )