21/06/2006 Page: 5
Create new text file on disk.
Private Sub mnuItemDate_Click() Wrap$=Char$(13) & Char$(10) txtNote.Text=Date$ & Wrap$ & txtNote.Text End Sub
Private Sub mnuItemSave_Click() CommonDialog1.Filter="Text Files(*.txt) *.txt" CommonDialog1.ShowSave if CommonDialog1.Filename<>"" Then Open CommonDialog1.Filename for output as #1 Print #1, txtNote.Text Close #1 EndIf End Sub.
Sorting Text: Draw up a list of items to sort, compare items one by one until list is sorted in ascending or descending order. Most common with Strings is concatenating them by using & operator. Example: slogan$="Bring" & "on the" & "Circus". Use keywords in String expression UCase for Capital letter Example: Ucase("ram") returns RAM. LCase, Len, Right, Left, Mid, InStr, String, Asc, Chr, Xor. Sort array Redim strArray$(linecount%) curline%=1 In$="" For i%=1 to charsInFile% letter%=Mid(txtNote.Textm i%, 1) if letter$=Chr$(13) then curline%=curline%
1 i%=i%+1 In$="" Else In$=In$ & letter$ strArray(curline%)=In$ EndIf Next i% ShellSort strArray$(), lineCount %.
Encryption: Mathematically alters the characters in a file making them unreadable.
Example: Here at last my friend you have the little book.
mnuItemSave_Click() encrypt$="" CharsInFile$=Len(txtNote.Text) For i%=1 to CharsInFile$ letter$=Mid(txtNote.Text, i%, 1) encrypt$=encrypt$ &Chr(Asc(letter$) +1) Next i% Open CommonDialog1.Filename For output as #1 Print#1, encrypt$ txtNote.Text=encrypt$
encrypt$=encrypt$ & Chr(Asc(letter$ +1) .. This statement determines the ASCII code for current letter and adds 1 bit converts ASCII code back to a letter, and adds it to encrypt$ string.
Decrypt: decrypt$="" CharsInFile=Len(AllText$) For i%=1 to CharsInFile letter$ Mid(AllText$, i%, 1) decrypt$=decrypt$ &Chr(Asc(letter$ +1) Next i% txtNote.Text=decrypt$.
Working with Database in VB: Database is an organized collection of information stored in a file. We can create database files using MSAccess, MSFoxpro, Paradox. Customised database application is a program that takes fields and records of database and displays them meaningfully.
Bound Controls: An Object is bound to a database when its Datasource Property is set to a valid Database Name and its DataField Property is set to a valid Tablein the database. After connection display database information by using Objects created with CheckBox, ComboBox, Image, Label, ListBox, PictureBox, TextBox.
Home |
VB6-1 |
VB6-2 |
VB6-3 |
VB6-4 |
VB6-5 |
HTML-1 |
HTML-2 | This site was last updated
06/21/06