Here I got a few simple tricks. Some are probably pretty hard to understand but I hope you will work it out. You maybe think that these tricks would be better if they were explained better but this section I hope there is something for everyone. Happy hunting:

Write to a file
Read from a file
Copy and Paste
Communication
Dial a number
Close a COM-port
The "\" problem
Message boxes
Copy file
Delete file
Create a directory
Delete a directory
Rename a file
Delete the last character in a textbox
Check mousebutton
If-Then
Do While
Do Loop While
Do Until
Select Case
LoadPicture
Screen Resolution



Write to a file:
filename = text1.text
if filename = "" then goto errhandl
step1 = text2.text
open filname for output as #1
print #1, step1
close #1

exit sub
errhandl:
msgbox "Please enter a filename"

Read from a file:

filename = text1.text
if filename = "" then exit sub
open filename for input as #1
input #1, step1
close #1
text2.text = step1

Copy & Paste:

Copy:
clipboard.settext
form1.text1.seltext

Paste:
form1.text1.seltext = clipboard.gettext()

Communication:

Initialize the COM-port:
Comm1.CommPort = 2
Comm1.Settings = "14400,N,8,1"


Dial a number:

Comm1.PortOpen = True
Comm1.OutPut = "ATDT" + text1.text + Chr$(13)
'text1.text = the number you want to dial and Chr$(13) is ENTER


Close the COM-port:

Comm1.PortOpen = False


The "\" problem:

If Right(Dir1.Path,1) <> "\" Then
Text1.Text = Dir1.Path & "\" & File1.FileName
Else
Text1.Text = Dir1.Path & File1.FileName
End If

Message boxes:

Syntax:
MsgBox("message",type,"titel")

Ex:
MsgBox("Do you want to start the program?",4,"Start Program?")


Copy file:

Text1.Text = c:\dev\vb16\vb.exe
Text2.Text = c:\dev\exes\

FileCopy Text1,Text2

Delete file:

Text1.Text = c:\temp\wrong.zip
Kill Text1


Create a directory:

Text1.Text = c:\dev\temp
MkDir Text1.Text


Delete a directory:

Text1.Text = c:\dev\temp
RmDir Text1


Rename a file:

Text1.Text = vb3.txt
Text2.Text = vb4.txt
Name Text1 As Text2


Delete the last character in a textbox:

Text1 = Left(Text1, Len(Text1) - 1)


Check Mousebutton:

If Button = 1 Then MsgBox "You have pressed the LEFT button"
If Button = 2 Then MsgBox "You have pressed the RIGHT button"
If Button = 3 Then MsgBox "You have pressed the LEFT and RIGHT button"
If Button = 4 Then MsgBox "You have pressed the MIDDLE button"


If-Then:

If Text1.Text = Text2.Text Then Text3.Text = "Hello world"
End If


Do-While:

HomeAlone = True
Do While HomeAlone = True
Text1.Text = "Are your parents home?"
If txtAnswer.Text = "Yes" Then HomeAlone = False
Loop


Do Loop While:

HomeAlone = True

Do
Text1.Text = "Are your parents home?"
If txtAnswer.Text = "Yes" Then HomeAlone = False
Lopp While HomeAlone = True


Do Until:

HomeAlone = True
Do Until HomeAlone = False
Text1.Text = "Are you home alone?"
If txtAnswer.Text = "No" Then HomeAlone = False
Loop

Select Case:

Dim Grade as string
Select Case Grade
Case "A": Label1.Caption = "WOW"
Case "B": Label1.Caption = "Very Good"
Case "C": Label1.Caption = "OK"
Case else: Label1.Caption = "You Suck"

LoadPicture:

Image1.picture = Loadpicture("C:\picture.jpg")
Clear Picturebox: LoadPicture()

Screen Resolution:

CR$ = Chr$(13) + Chr$(10)
TWidth% = screen.Width \ screen.TwipsPerPixelX
THeight% = screen.Height \ screen.TwipsPerPixelY
MsgBox "Screen Resolution:" + CR$ + CR$ + Str$(TWidth%) + " x" + Str$(THeight%), 64, "Info"

For best performance: 800x600 High Color