Sunteți pe pagina 1din 8

If you want your program to become very popular you must use all what is below

But the license for this toturial is to vote for me at PSC and mention my web site in
your application http://asd1060.tripod.com

Contents
To read the content of the a list box
to add a row in the ListView
to remove an item from the listView
to remove a selected item from the listview
if there is more than a colomn on the listview and you want to add to
To put more than one line in the MsgBox
To create a directory
to view a submenu on the form when you right click it
to read a specific letter in a word in the text box
to know the windows version
to go to a new line use
to make an object on the top of the taskbar
To add a text to the listbox
to open a message box MsgBox
to declare an input dilog box
To show the current date and time
to show the date only
to show the time only
to take the value of a string
to declare a random number
to print to the defaut printer
to connect the File viewer with the Directory Viewer
to run a file
to save to the registry
to get from the registry
to click a button by pressing enter
to insert a picture in the button
if you where wrighting a code and it was too long and you want to
to make a word in the menu checked
if you want to type date or time or both
to make a declared variable limited
The <> means
How to use the case
to make a form in the center if the screen
to make a form full screen
to know how many forms in the project
to open files
to use the winsock

To read the content of the a list box

For i = 0 to list1.listcount
msgbox list1.list(i)
next i
to add a row in the ListView

listview1.listitems.add , , "text"

to remove an item from the listView

listView1.listitems.remove(Int)
note: the int is an integer variable wich stands for the number

of the list

to remove a selected item from the listview

ListView1.ListItems.Remove (ListView1.SelectedItem)

if there is more than a colomn on the listview and you want to add to

the next colomn

ListView1.ListItems.Add.SubItems(INT) = "txt"
note: the int is a integer variable wich stands for the number

of the colomn

To put more than one line in the MsgBox

dim msg as string

msg= "Line1" & vbCrLf


msg= msg & "Line2" & vbCrLf
msgbox msg

To create a directory

MkDir "Path\" & "Dir Name"


to view a submenu on the form when you right click it

private sub Form_MouseUp()


if button = 2 then
Form1.PopupMenu mnuPop
end sub

note: mnuPop is the menu

to read a specific letter in a word in the text box

Right(Text1.Text, 1) = "F"

note: (Right) means the direction of the textbox, (1) is the

number for the number of letters VB will read

to know the windows version

Dim LngVer As Long


Private Declare Function GetVersion Lib "kernel32" () As Long

Private Sub Command1_Click()


LngVer = GetVersion()

If LngVer = (143851525) Or ((LngVer And &H80000000) = 0) Then


MsgBox "Windows 2000, NT, XP"
Else
MsgBox "Win 9x"
End If
End Sub

to go to a new line use

vbCrLf

to make an object on the top of the taskbar

me.top = screen.height - 750


To add a text to the listbox
list1.additem "txt"

to open a message box MsgBox

msgbox "txt"

to declare an input dilog box

dim strIn as string

Private Sub Command1_Click()


strIn = InputBox("What is you name?", "The Title")
text1.text = strIn
end sub

To show the current date and time

msgbox now

to show the date only

msgbox date

to show the time only

msgbox time

to take the value of a string

msgbox Val(Text1.Text)
to declare a random number

dim Ran as Integer

Private sub command1_click()


ran = int(5 * rnd) + 1
text1.text = ran
end sub

note: the number 5 means from 1 to 5 and + 1 means that the

number must be between 1 and 5 and no 0

to print to the defaut printer

Printer.Print "txt"
Printer.EndDoc 'must end with this line

to connect the File viewer with the Directory Viewer

file1.path = dir1.path

to run a file

shell (path)

to save to the registry

SaveSetting App.Name, "Section", "Key", "text"

to get from the registry

text1.text = getsetting(App.Name, "Section", "Key")

to click a button by pressing enter


change the Default from False to True form the property panel of the

buton

to insert a picture in the button

first change the style to graphical and the add the picture form the

property panel of the buuton

if you where wrighting a code and it was too long and you want to

devide it into more lines

text1.text = "Hello " _


& "my web site is " _
& "http://asd1060.tripod.com"

to make a word in the menu checked

mnuTest.Checked = True

if you want to type date or time or both

put them bettween ##


#7:11 pm#

to make a declared variable limited

dim test as string * 5

The <> means

1 <> 2 that 1 doesn't equal 2


How to use the case

Select Case Text1.text


case "1"
msgbox "text1 contans 1"

case "2"
msgbox "text1 contains 2"

End Select

to make a form in the center if the screen

Form1.top = (screen.width - Form1.Width)/2


form1.left = (screen.Height - form1.height)/2

to make a form full screen

form1.width = screen.width
form1.height = screen.height

to know how many forms in the project

msgbox forms.count

to open files

open "File.txt" for Output as #1


print #1, "test"
close #1

to use the winsock


1. to listen
tcp.localport = 100
tcp.listen

2. to send data
tcp.sendData "test"
3. to connect
tcp.connect 127.0.0.1, 100

4. to recievs data
NTC.GetData Data, vbString, bytesTotal
Text1.Text = Data

5. recive connection
ntc.close
ntc.Accept requestID

S-ar putea să vă placă și