FAQ Basic 4 PPC ������� ���������


(Time (Now)) - ������ �����
AppPath - ������ ������� ���������
CancelClose - ������ �������� ����
Chr - ���������� ���� �������
Date(Now) - ������ ����
Do Until - ���� (���� �������)
ErrorLabel - ������� ��� ������ � ����
Exit - ����� �� �����
FileClose - �������� �����
FileDel - �������� �����
FileExist - �������� ������� �����
FileOpen - ������ � ����
FileOpen - �������� �����
FileOpen - ������ �� �����
For - ����
Form - ������� ����
ListBox - �������� ������
ListBox - ������ ���� ����� � ����
ListBox - �������� ��������� ������
ListBox - ������ ��������� ������
ListBox - ������ �� ����� ���� �����
Msgbox - ������� ���������� ��������
Msgbox - ����� �� ����� ������
OpenDialog - ������� ����� �����
OpenDialog - �������� ������
OpenDialog - �������� �� ����� �� �������
RGB - ����������� RGB �����
Rnd - ��������� ���������� �����
SaveDialog - ������� ����� �����
SaveDialog - �������� ������
SaveDialog - �������� �� ����� �� �������
Shell - ������ ������ ��������
Sleep - ������������ ����������
Sound - ��������������� WAV
specialKey - �������� ������� �������
StrAt - ����� ������ �� ������
StrIndexOf - ����� ����� ������ � ������
StrInsert - ������� � ������
StrLength - ������ ����� ������
StrRemove - ������� ����� ������ � �����
StrReplace - ������ ������� � ������
StrToUpper - ������� ��� ������� ������ ��������
Sub - ���������� �������
TextBox - ������ ���� ����� � ����
TextBox - ������ ���� ����� �� �����

(Time (Now)) - ������ �����
Msgbox (Time (Now))


AppPath - ������ ������� ���������
Msgbox(AppPath)


CancelClose - ������ �������� ����
Form1.CancelClose


Chr - ���������� ���� �������
Chr(34)

Chr (Integer)


Date(Now) - ������ ����
Msgbox (Date(Now))


Do Until - ���� (���� �������)
Do Until r=EOF
...
Loop


ErrorLabel - ������� ��� ������ � ����
ErrorLabel(Err)

Err: '-���� ��������


Exit - ����� �� �����
For n = 1 to 100
If n = TextBox1.Text Then Exit
Next


FileClose - �������� �����
FileClose (���������� �����)

���������� ������� ���� String


FileDel - �������� �����
FileDel (AppPath&"\file.txt")


FileExist - �������� ������� �����
If FileExist ("C:\1.txt") = true Then
...

End If


FileOpen - ������ � ����
FileOpen (c1,"C:\1.txt",cWrite,,cASCII)
FileWrite (c1,"20") '������� � ������ ������ 20
FileWrite (c1,"30") '������� � ������ ������ 30
FileWrite (c1,TextBox1.Text)'������� � ������ �����
FileClose (c1)


FileOpen - �������� �����
FileOpen (���������� �����,"��� �����",���� ������,���������)

���������� ������� ���� String

��� ����� ������� ���� String

����� ������:
cRead - ������
cWrite - ������
cAppend - ������ � ����� ����� (����������)

���������:
cASCII


FileOpen - ������ �� �����
FileOpen (c1,"C:\1.txt",cRead,,cASCII)
TextBox1.Text = FileRead (c1) '������� 1 ������
TextBox1.Text = FileRead (c1) '������� 2 ������
FileClose (c1)


For - ����
For n = 1 to 100
If n = TextBox1.Text Then Exit
Next


Form - ������� ����
Form1.Close '- ���� ������� �� �����


ListBox - �������� ������
ListBox1.Add("������")


ListBox - ������ ���� ����� � ����
FileOpen(c1,AppPath&"\db.db",cWrite)
FileWrite(c1,ListBox1.Item(0))
i=Int(1)
Do Until i = ListBox1.Count

FileWrite(c1,ListBox1.Item(i))
FileClose(c1)
i=i+1
Loop


ListBox - �������� ��������� ������
a=ListBox1.Item(ListBox1.SelectedIndex)

ListBox1.Remove(a)


ListBox - ������ ��������� ������
Msgbox(ListBox1.Item(Index))


ListBox - ������ �� ����� ���� �����
FileOpen (c1,"C:\1.txt",cRead,,cASCII)

a = FileRead (c1)'������ ������ ������

If a<>EOF Then ListBox1.Add(a)'���� �������
'�������� ������
Do Until a = EOF '���� �� ����� �����
a = FileRead (c1)
If a<>EOF Then ListBox1.Add(a)
Loop



FileClose (c1) '��������� ����


Msgbox - ������� ���������� ��������
i = Msgbox("�� �������?","���������",cMsgboxYesNo,cMsgboxQuestion)
If i = cYes Then
....
....
Else If i = cNo Then

End If


Msgbox - ����� �� ����� ������
Msgbox ("���� ������")


OpenDialog - ������� ����� �����
OpenDialog1.Show
Msgbox(OpenDialog1.File)


OpenDialog - �������� ������
OpenDialog1.Show


OpenDialog - �������� �� ����� �� �������
If OpenDialog1.Show <> cCancel Then
...
End If


RGB - ����������� RGB �����
pen1.Color = RGB (255,255,255)

RGB (R, G, B)



Rnd - ��������� ���������� �����
i = Rnd (30, 60)

30 - �� 30
60 - �� 60


SaveDialog - ������� ����� �����
SaveDialog1.Show
Msgbox(SaveDialog1.File)


SaveDialog - �������� ������
SaveDialog1.Show


SaveDialog - �������� �� ����� �� �������
If SaveDialog1.Show <> cCancel Then
...
End If


Shell - ������ ������ ��������
Shell ("Calc.exe", "")

Shell (Program File, Arguments)


Sleep - ������������ ����������
Sleep(1000)

Sleep (Milliseconds)


Sound - ��������������� WAV
Sound ("\Sounds\Beep.wav")

Sound (Wave File)



specialKey - �������� ������� �������
Sub Form1_KeyPress (specialKey)
If specialKey=cMiddleKey Then Msgbox("yes")
End Sub

cDownKey
cLeftKey
cMiddleKey
cRightKey
cUpKey


StrAt - ����� ������ �� ������
����� ������� ������ ���������� � 0
������: a = StrAt ("abcdef" , 3)
������: a = "d"

StrAt (String, Index)


StrIndexOf - ����� ����� ������ � ������
������:
Msgbox (StrIndexOf ("abcdef" , "cd",0))
'����� � 0 �������
��������� : Displays 2.


������:
Msgbox (StrIndexOf ("abcdef" , "ab",1))
'����� � 1 �������
���������: Displays -1 (not found)

StrIndexOf (String, Value, StartIndex)


StrInsert - ������� � ������
Old = "12567"
New = StrInsert (Old,2,"34")
Result: New = "1234567"

StrInsert (String, StartIndex, Value)


StrLength - ������ ����� ������
������: Msgbox (StrLength ("Basic4ppc"))
���������: Displays 9

StrLength (String)


StrRemove - ������� ����� ������ � �����
Old = "Basic4ppc"
New = StrRemove (Old ,6 , 3)
Result: New = "Basic4"

3 - ������� �� ����� � 3-�� �������
6 - ��������� 6 ��������


StrReplace - ������ ������� � ������
s = "The sun is bright"
s = StrReplace (s," ","") '�������� �������
Result: s = "Thesunisbright"

StrReplace (������ , ������������, �����������)


StrToUpper - ������� ��� ������� ������ ��������
������: Msgbox (StrToUpper("AbCdE"))
���������: Displays "ABCDE"

StrToUpper (������)


Sub - ���������� �������
Sub Button1_Click
Msgbox("The mean of 20 and 30 is " & Mean(20,30))
End Sub


Sub Mean (a,b)
Return (a+b)/2 '��������� ��� 20,30
End Sub


Sub SubName (Parameters)

End Sub


TextBox - ������ ���� ����� � ����
FileOpen(c1,"C:\1.txt",cWrite)
FileWrite(c1,TextBox1.Text)
FileClose(c1)


TextBox - ������ ���� ����� �� �����
FileOpen(c1,"C:\1.txt",cRead)
TextBox1.Text = FileReadToEnd(c1)
FileClose(c1)


������ ���� ������������ ���������� Rec Office

22.03.2009-0:54:26