Visual Basic (viết tắt VB) là một ngôn ngữ lập trình hướng sự kiện (event-driven) và môi trường phát triển tích hợp (IDE) kết bó được phát triển đầu tiên bởiAlan Cooper dưới tên Dự án Ruby (Project Ruby), và sau đó được Microsoft mua và cải tiến nhiều. Visual Basic đã được thay thế bằng Visual Basic .NET. Phiên bản cũ của Visual Basic bắt nguồn phần lớn từ BASIC và để lập trình viên phát triển các giao diện người dùng đồ họa (GUI) theo mô hình phát triển ứng dụng nhanh (Rapid Application Development, RAD); truy cập các cơ sở dữ liệu dùng DAO (Data Access Objects), RDO (Remote Data Objects), hayADO (ActiveX Data Objects); và lập các điều khiển và đối tượng ActiveX.
Một lập trình viên có thể phát triển ứng dụng dùng các thành phần (component) có sẵn trong Visual Basic. Các chương trình bằng Visual Basic cũng có thể sử dụng Windows API, nhưng làm vậy thì phải sử dụng các khai báo hàm bên ngoài.
Trong lĩnh vực lập trình thương mại, Visual Basic có một trong những nhóm khách hàng lớn nhất. Theo một số nguồn, vào năm 2003, 52% của những lập trình viên sử dụng Visual Basic, làm nó thành ngôn ngữ lập trình phổ biến nhất vào lúc đó. Tuy nhiên, cuộc nghiên cứu của Evans Data cho rằng 43% của các lập trình viên đó có ý định đổi qua một ngôn ngữ khác.
231 trang |
Chia sẻ: tlsuongmuoi | Lượt xem: 2444 | Lượt tải: 0
Bạn đang xem trước 20 trang tài liệu Lập trình Web bằng Visual Basic, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
alse
Else
barpassword = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
End If
Exit Sub
End If
'vao menu con cua muc Show Battery Meter
If volume.Visible = True Then
volume.Visible = False
tbnhap.Visible = True
Frame1.Height = 500
Frame1.Width = 1800
tbnhap.Text = "Menu"
Exit Sub
End If
If tbnhap.Text = "Show Battery Meter" Or (luumuc = 11 And quickaccess = True And longpress = False) Then
volume.Visible = True
tbnhap.Visible = False
Frame1.Height = 240
Frame1.Width = 1800
volume.Picture = battery.Picture
cancle = True
danhso = False
quickaccess = False
features = False
luumuc = 0
Exit Sub
End If
'phan xu ly cua menu restrict my phone number
If tbnhap.Text = "Show ID On Next Call" Or tbnhap.Text = "Restrict ID On Next Call" Or tbnhap.Text = "Cancle All Diverting" Then
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
'xu ly cua phan call barring
If tbnhap.Text = "Int'l Calls" Or tbnhap.Text = "Int'l Calls Except Home" Then
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
If tbnhap.Text = "All Calls" Then
callbarring = True
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
If tbnhap.Text = "Off?" Then
callbarring = False
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
'xu ly cua phan Bar Incoming Calls
If tbnhap.Text = "When Roaming" Or tbnhap.Text = " All Calls" Or tbnhap.Text = "Off? " Then
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
If tbnhap.Text = "Cancel All Barring" Then
callbarring = False
tbnhap.Text = "Completed"
features = False
Exit Sub
End If
'vao phan xu ly cua menu Messages
If tbnhap.Text = "Messages" Then
tbnhap.Text = "Call Voicemail"
message1 = True
Exit Sub
End If
'phan xu ly trong muc Message Editor
If tbnhap.Text = "Message Editor" Or (luumuc = 15 And quickaccess = True) Then
taomoi = False
quickaccess = False
luumuc = 0
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
If banghi = 0 Then
tbnhap.Text = ""
editor = True
danhso = False
cancle = False
message1 = False
Else
Get #1, banghi, message
tbnhap.Text = Trim(message.tin)
messagenumber = banghi
editor = True
danhso = False
cancle = False
message1 = False
End If
Close #1
Exit Sub
End If
If editor = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
st = tbnhap.Text
tbnhap.Text = " Send Message"
editor = False
cancle = True
danhso = False
End If
Exit Sub
End If
If tbnhap.Text = "Cell Broadcast" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Message Settings" Then
tbnhap.Text = "Voicemail Number"
Exit Sub
End If
If tbnhap.Text = "Outgoing Message Type" Then
tbnhap.Text = "Text"
Exit Sub
End If
'phan xu ly cua menu Outgoing Message
If tbnhap.Text = "Outgoing Messages" Or tbnhap.Text = "Outgoing SMS?" Then '(luumuc = 14 And quickaccess = True) Then
messagelist = True
quickaccess = False
thu = False
luumuc = 0
cancle = False
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
If banghi = 0 Then
tbnhap.Text = "No Message Stored"
messagelist = False
Else
Get #1, 1, message
tbnhap.Text = Trim(message.tin)
messagenumber = 1
'cancle = True
danhso = False
End If
Close #1
Exit Sub
End If
If messagelist = True Then
tbnhap.Text = "Send Message"
messagelist = False
Exit Sub
End If
If tbnhap.Text = "Send Message" Or tbnhap.Text = " Send Message" Then
tbnhap.Text = " Enter Number"
danhso = False
cancle = True
message1 = True
Exit Sub
End If
If tbnhap.Text = " Enter Number" Then
tbnhap.Text = ""
message1 = False
danhso = True
cancle = True
send = True
Exit Sub
End If
If sending = True Then
If tbnhap.Text = "" Then
sending = False
Exit Sub
End If
messagelist = False
sending = False
tbnhap.Text = "Sending"
message1 = False
flag = False
menucon = False
Exit Sub
End If
'phan xu ly cua muc Edit Message
If tbnhap.Text = "Edit Message" Then
taomoi = False
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
Get #1, messagenumber, message
tbnhap.Text = Trim(message.tin)
danhso = False
cancle = False
editor = True
message1 = False
Close #1
Exit Sub
End If
'phan xu ly cua muc Store Message
If tbnhap.Text = "Store Message" Then
Call store_message
message1 = False
Exit Sub
End If
'phan xu ly cua muc delete message trong Outgoing Message
If tbnhap.Text = "Delete Message" Then
Call delete_message
message1 = False
danhso = False
cancle = True
Exit Sub
End If
'xu ly cua muc Go to next Message trong Outgoing Message
If tbnhap.Text = "Go to Next Message" Then
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
If banghi <= messagenumber Then
Get #1, 1, message
tbnhap.Text = Trim(message.tin)
Else
messagenumber = messagenumber + 1
Get #1, messagenumber, message
tbnhap.Text = Trim(message.tin)
End If
messagelist = True
Close #1
Exit Sub
End If
'xu ly khi gap truong hop No Msg Stored
If tbnhap.Text = "No Message Stored" Then
message1 = False
tbnhap.Text = "Menu"
danhso = True
cancle = True
Exit Sub
End If
'vao trong muc voicemail number cua message setting
If tbnhap.Text = "Voicemail Number" Then
tbnhap.Text = voicemailnumber
danhso = True
cancle = True
setting = True
message1 = False
voice = True
Exit Sub
End If
If voice = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
voicemailnumber = tbnhap.Text
voice = False
tbnhap.Text = "Completed"
danhso = False
cancle = True
setting = False
Exit Sub
End If
End If
'vao trong muc Service Centre cua message setting
If tbnhap.Text = "Service Centre" Then
tbnhap.Text = servicecentre
danhso = True
cancle = True
setting = True
service = True
message1 = False
Exit Sub
End If
If service = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
servicecentre = tbnhap.Text
service = False
tbnhap.Text = "Completed"
danhso = False
setting = False
Exit Sub
End If
End If
'vao trong muc Expiry Period cua message setting
If tbnhap.Text = "Expiry Period" Then
tbnhap.Text = expiryperiod
danhso = True
cancle = True
setting = True
message1 = False
expiry = True
Exit Sub
End If
If expiry = True Then
If tbnhap.Text = "" Then
Exit Sub
Else
expiryperiod = tbnhap.Text
expiry = False
tbnhap.Text = "Completed"
danhso = False
setting = False
Exit Sub
End If
End If
'xu ly cua phan Call Voicemail
If tbnhap.Text = "Call Voicemail" Or (luumuc = 12 And quickaccess = True) Then
If longpress = True Then
Exit Sub
End If
tbnhap.Text = "Calling"
danhso = False
cancle = True
Image2.Visible = True
message1 = False
quickaccess = False
luumuc = 0
Exit Sub
End If
'******** vao menu con cua muc Phone Setup ********
If tbnhap.Text = "Phone Setup" Then
tbnhap.Text = "Select Phone Line"
setup = True
Exit Sub
End If
'vao menu con cua muc Select phone line
If tbnhap.Text = "Select Phone Line" Or (luumuc = 7 And quickaccess = True) Then 'longpress = False) Then
quickaccess = False
luumuc = 0
tbnhap.Text = "Line 1"
danhso = False
cancle = True
Exit Sub
End If
If tbnhap.Text = "Line 1" Then
tbnhap.Text = "Completed"
line2 = False
setup = False
Exit Sub
End If
If tbnhap.Text = "Line 2" Then
tbnhap.Text = "Completed"
quickaccess = False
line2 = True
setup = False
Exit Sub
End If
'vao menu con cua muc Adjust Ring Volume
If volume.Visible = True Then 'And so(14).Value = False And so(15).Value = False Then
volume.Visible = False
tbnhap.Visible = True
Frame1.Height = 500
Frame1.Width = 1800
tbnhap.Text = "Menu"
advolume = False
setup = False
Exit Sub
End If
If (tbnhap.Text = "Adjust Ring Volume" And setup = True) Or (luumuc = 6 And quickaccess = True) Then 'longpress = False) Then
volume.Visible = True
tbnhap.Visible = False
Frame1.Height = 240
Frame1.Width = 1790
volume.Picture = volume1(vol).Picture
advolume = True
setup = False
cancle = True
danhso = False
quickaccess = False
luumuc = 0
Exit Sub
End If
'vao menu con cua muc Ring or vibrate
If tbnhap.Text = "Ring or Vibrate" Then
tbnhap.Text = "Ring Only"
Exit Sub
End If
If luumuc = 9 And quickaccess = True Then
If longpress = True Then
Exit Sub
End If
quickaccess = False
luumuc = 0
If Image7.Visible = False Then
Image7.Visible = True
Else
Image7.Visible = False
End If
danhso = False
cancle = True
tbnhap.Text = "Completed"
Exit Sub
End If
If tbnhap.Text = "Ring Only" Or tbnhap.Text = "Vibrate Then Ring" Or tbnhap.Text = "Vibrate Only" Or tbnhap.Text = "No Ring or Vibrate" Then
If tbnhap.Text = "Vibrate Only" Or tbnhap.Text = "No Ring or Vibrate" Then
Image7.Visible = False
Else
Image7.Visible = True
End If
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
'vao menu con cua muc Set ringer tone
If tbnhap.Text = "Set Ringer Tone" Then
tbnhap.Text = "Standard Tone"
Exit Sub
End If
If tbnhap.Text = "Standard Tone" Or tbnhap.Text = "Music Tone" Then
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
'vao menu con cua muc Set ringer tone 2
If tbnhap.Text = "Set Ringer Tone 2" Then
tbnhap.Text = "Standard Tone"
Exit Sub
End If
'vao menu cua muc Phone Lock
If tbnhap.Text = "Phone Lock" Then
tbnhap.Text = "Automatic Lock"
Exit Sub
End If
If tbnhap.Text = "Automatic Lock" Then
tbnhap.Text = " On "
Exit Sub
End If
If Left(tbnhap.Text, 5) = " On " Then
autolocked = True
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = " Off " Then
tbnhap.Text = "Completed"
setup = False
autolocked = False
Exit Sub
End If
If tbnhap.Text = "Lock Now" Or (luumuc = 5 And quickaccess = True) Then
tbnhap.Text = "Locked"
locked = True
setup = False
quickaccess = False
luumuc = 0
Exit Sub
End If
If Left(tbnhap.Text, Len("Unlock Code")) = "Unlock Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = unlocked Then
locked = False
tbnhap.Text = "Menu"
setup = False
Else
tbnhap.Text = "Not Match"
danhso = False
End If
Exit Sub
End If
If tbnhap.Text = " Change Unlock Code" Then
tbnhap.Text = "Old Code" & vbCrLf
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 8) = "Old Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = unlocked Then
tbnhap.Text = "New Code" & vbCrLf
Else
tbnhap.Text = " Not Match"
danhso = False
End If
Exit Sub
End If
If Left(tbnhap.Text, 8) = "New Code" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) 4 Then
tbnhap.Text = "Enter 4 Digit"
danhso = False
Exit Sub
Else
unlocked = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
danhso = False
setup = False
Exit Sub
End If
End If
If tbnhap.Text = "Require SIM Card PIN" Then
tbnhap.Text = " On."
Exit Sub
End If
'xu ly cua muc Change SIM Pin2 code
If tbnhap.Text = "Change SIM PIN2 Code" Then
tbnhap.Text = "Current PIN2 Code" & vbCrLf
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 17) = "Current PIN2 Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = pin2code Then
tbnhap.Text = "New PIN2 Code" & vbCrLf
Else
tbnhap.Text = " Invalid Code"
danhso = False
End If
Exit Sub
End If
If Left(tbnhap.Text, 13) = "New PIN2 Code" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) 8 Then
tbnhap.Text = "Enter 4-8 Digit"
danhso = False
Else
pin2code = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
setup = False
End If
Exit Sub
End If
'xu ly cua phan New Security Code
If tbnhap.Text = "New Security Code" Then
tbnhap.Text = "Current Code" & vbCrLf
danhso = True
setup = False
Exit Sub
End If
If Left(tbnhap.Text, 12) = "Current Code" Then
k = InStr(tbnhap.Text, vbLf)
If Mid(tbnhap.Text, k + 1) = securitycode Then
tbnhap.Text = "New Security Code" & vbCrLf
Else
tbnhap.Text = "Invalid Code"
danhso = False
End If
Exit Sub
End If
If Left(tbnhap.Text, 17) = "New Security Code" Then
k = InStr(tbnhap.Text, vbLf)
If Len(Mid(tbnhap.Text, k + 1)) 6 Then
tbnhap.Text = "Enter 6 Digit"
danhso = False
Else
securitycode = Mid(tbnhap.Text, k + 1)
tbnhap.Text = "Completed"
danhso = False
setup = False
End If
Exit Sub
End If
'xu ly cua phan Extended Menus
If tbnhap.Text = "Extended Menus" Then
tbnhap.Text = " On"
Exit Sub
End If
If tbnhap.Text = " On" Then
extend = True
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = " Off" Then
extend = False
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "Show Time and Date" Or (luumuc = 8 And quickaccess = True) Then
tbnhap.Text = Format(Now, "Medium Date") & vbCrLf & Format(Now, "Short Time")
If longpress = True Then
showtime = False 'True
Else
showtime = True
End If
setup = False
quickaccess = False
luumuc = 0
Exit Sub
End If
If tbnhap.Text = "Set Time and Date" Then
tbnhap.Text = "Enter Time" & vbCrLf
setup = False
cancle = False
Exit Sub
End If
If Left(tbnhap.Text, 10) = "Enter Time" Then
j = InStr(tbnhap.Text, vbLf)
If Not IsDate(Mid(tbnhap.Text, j + 1)) Then 'k 24 Then
tbnhap.Text = "Invalid Time"
cancle = True
danhso = False
Exit Sub
Else
newtime = Mid(tbnhap.Text, j + 1)
tbnhap.Text = "Enter Date" & vbCrLf
End If
Exit Sub
End If
If Left(tbnhap.Text, 10) = "Enter Date" Then
j = InStr(tbnhap.Text, vbLf)
If Not IsDate(Mid(tbnhap.Text, j + 1)) Then
tbnhap.Text = "Invalid Date"
cancle = True
danhso = False
Exit Sub
Else
newdate = Mid(tbnhap.Text, j + 1)
End If
Time = newtime
Date = newdate
tbnhap.Text = "Completed"
cancle = True
Exit Sub
End If
If tbnhap.Text = "Set Time Format" Then
tbnhap.Text = "12-hour?"
Exit Sub
End If
If tbnhap.Text = "12-hour?" Then
formattime = False
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "24-hour?" Then
formattime = True
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "Battery Saving Mode" Then
tbnhap.Text = "On"
setup = False
Exit Sub
End If
If tbnhap.Text = "On" Then
tbnhap.Text = "Completed"
features = False
network = False
accessory = False
message1 = False
Exit Sub
End If
If tbnhap.Text = "Off" Then
tbnhap.Text = "Completed"
features = False
network = False
accessory = False
message1 = False
Exit Sub
End If
If tbnhap.Text = "Select Keypad Tones" Then
tbnhap.Text = "Normal Tones"
Exit Sub
End If
If tbnhap.Text = "Normal Tones" Or tbnhap.Text = "Single Tone" Or tbnhap.Text = "No Tones" Then
tbnhap.Text = "Completed"
setup = False
Exit Sub
End If
If tbnhap.Text = "Phone Status" Then
tbnhap.Text = "Status Review"
Exit Sub
End If
'phan xu ly cua menu Network Selection
If tbnhap.Text = "Network Selection" Then
tbnhap.Text = " Change Band"
network = True
Exit Sub
End If
If tbnhap.Text = " Change Band" Or (luumuc = 10 And quickaccess = True) Then 'longpress = False) Then
tbnhap.Text = "Change to 900/1800"
danhso = False
cancle = True
quickaccess = False
luumuc = 0
Exit Sub
End If
If tbnhap.Text = "Available Networks" Then
tbnhap.Text = "Wait.."
addnetwork = False
availablenetwork = True
Exit Sub
End If
If tbnhap.Text = "Choose From Available" Or tbnhap.Text = "Choose From Known" Then
addnetwork = True
availablenetwork = False
tbnhap.Text = "Wait.."
Exit Sub
End If
If tbnhap.Text = "Network Search" Then
tbnhap.Text = "Registration Preferences"
Exit Sub
End If
If tbnhap.Text = "Registration Preferences" Then
tbnhap.Text = "Automatic Search Mode"
Exit Sub
End If
If tbnhap.Text = "Automatic Search Mode" Or manualsearch = True Then
tbnhap.Text = "Registerring"
cancle = True 'False
danhso = False 'True
manualsearch = False
network = False
Exit Sub
End If
If tbnhap.Text = "Manual Search Mode" Then
Open filename5 For Random As #1 Len = Len(networks)
Get #1, 1, networks
tbnhap.Text = networks.mang
tam1 = 1
availablenetwork = True
manualsearch = True
Close #1
Exit Sub
End If
If tbnhap.Text = "Frequency of Search" Then
tbnhap.Text = "Slow Search"
Exit Sub
End If
'xu ly cua phan Preferred Networks
If tbnhap.Text = "Preferred Networks" Then
tbnhap.Text = "Add Network to List"
Exit Sub
End If
If tbnhap.Text = "Add Network to List" Then
tbnhap.Text = "Choose From Available"
Exit Sub
End If
If tbnhap.Text = "Show List of Networks" Then
Open filename6 For Random As #1 Len = Len(networks)
banghi = LOF(1) \ Len(networks)
If banghi = 0 Then
tbnhap.Text = "No Network in List"
Close #1
Exit Sub
End If
Get #1, 1, networks
tbnhap.Text = networks.mang
st = networks.mang
tam1 = 1
showlist = True
Close #1
Exit Sub
End If
If tbnhap.Text = "No Network in List" Then
tbnhap.Text = "Network Selection"
Exit Sub
End If
'xu ly cua muc Move to New Location
If showlist = True Then
tbnhap.Text = "Move to New Location"
showlist = False
Exit Sub
End If
If tbnhap.Text = "Move to New Location" Then
tbnhap.Text = "New Location?" & vbCrLf
danhso = True
cancle = True
network = False
Exit Sub
End If
If Left(tbnhap.Text, 4) = "New " Then
k = InStr(tbnhap.Text, vbLf)
lo = Val(Mid(tbnhap.Text, k + 1))
If lo = 0 Then
tbnhap.Text = "New Location?" & vbCrLf
Exit Sub
End If
Call movenew(tam1, lo)
network = False
showlist = False
End If
'xu ly cua muc Delete Network
If tbnhap.Text = "Delete Network" Then
tbnhap.Text = "Are you sure?"
Exit Sub
End If
If tbnhap.Text = "Are you sure?" Then
Call xoa(tam1)
network = False
showlist = False
Exit Sub
End If
'xu ly cua phan Find New Network
If tbnhap.Text = "Find New Network" Then
tbnhap.Text = "Finding"
network = False
Exit Sub
End If
'phan xu ly cua muc Change Band
If tbnhap.Text = "Change to 900/1800" Or tbnhap.Text = "Change to 900" Or tbnhap.Text = "Change to 1800" Then
tbnhap.Text = "Completed"
quickaccess = False
danhso = False
cancle = True
network = False
Exit Sub
End If
If addnetwork = True Then
availablenetwork = False
tbnhap.Text = " Location?" & vbCrLf
danhso = True
cancle = True
addnetwork = False
network = False
Exit Sub
End If
'xu ly cua muc available network
If availablenetwork = True Then
tbnhap.Text = "Register Now"
availablenetwork = False
Exit Sub
End If
If tbnhap.Text = "Register Now" Then
tbnhap.Text = "Register"
network = False
Exit Sub
End If
If tbnhap.Text = "Make Preferred" Then
tbnhap.Text = " Location?" & vbCrLf
danhso = True
cancle = True
network = False
Exit Sub
End If
If Left(tbnhap.Text, 10) = " Location?" Then
k = InStr(tbnhap.Text, vbLf)
lo = Val(Mid(tbnhap.Text, k + 1))
If lo = 0 Then
tbnhap.Text = " Location?" & vbCrLf
Exit Sub
End If
Call preferredlist(lo, st)
tbnhap.Text = "Completed"
network = False
danhso = False
Exit Sub
End If
'phan xu ly cua muc Frequency of search
If tbnhap.Text = "Slow Search" Or tbnhap.Text = "Medium Search" Or tbnhap.Text = "Fast Search" Or tbnhap.Text = "Continuous Search" Then
tbnhap.Text = "Completed"
network = False
danhso = False
Exit Sub
End If
'phan xu ly cua menu Accessory Setup
If tbnhap.Text = "Accessory Setup" Then
tbnhap.Text = "Mute Car Radio"
accessory = True
Exit Sub
End If
'vao menu con cua cac muc trong Accessory setup
If tbnhap.Text = "Mute Car Radio" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Automatic Answer" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Automatic Handsfree" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Safety Timer" Then
tbnhap.Text = "On"
Exit Sub
End If
If tbnhap.Text = "Auxiliary Alert" Then
tbnhap.Text = "On"
Exit Sub
End If
'phan xu ly cua muc Quick Access Menu
If longpress = True Then 'And st "" Then
Open filename3 For Random As #1 Len = Len(menuaccess)
Get #1, orderinquick, menuaccess
menuaccess.feature = st
menuaccess.thutu = luumuc
Put #1, orderinquick, menuaccess
Close #1
longpress = False
tbnhap.Text = "Completed"
thu = False
quickaccess = False
Exit Sub
End If
'truong hop user nhap vao mot so de lam mot cuoc goi
If IsNumeric(tbnhap.Text) = True And sending = False Then
st = tbnhap.Text
If Len(tbnhap.Text) < 7 Then
If tbnhap.Text = "1080" Or tbnhap.Text = "113" Or tbnhap.Text = "114" Or tbnhap.Text = "115" Then
cancall = False
Else
cancall = True
End If
If send = True Then
sending = True
send = False
End If
End If
danhso = False
cancle = True
tbnhap.Text = "Calling" '" Call Number"
Image2.Visible = True
callnumber = True
End If
'truong hop user nhap vao so dien thoai co format khong phu hop
If tbnhap.Text = "Connecting Failed" Then
tbnhap.Text = "Menu"
Exit Sub
End If
'********* phim left *********
Case 14
'menu con cua muc Personal Number
If quickaccess = True Then
Exit Sub
End If
'xu ly cua muc Adjust Ring Volume
If advolume = True Then
i = i + 1
If vol > 0 Then
Select Case i
Case 3, 6, 9, 12, 15, 18, 21
vol = vol - 1
volume.Picture = volume1(vol).Picture
End Select
Else
Beep
End If
Exit Sub
End If
'********** phim phai **********
Case 15
If quickaccess = True Then 'longpress = True Then
Exit Sub
End If
If cancle = False Then
Select Case i
Case 0
tbnhap.Text = tbnhap.Text & Right(tbnhap.Text, 1)
i = i + 1
Case 1
tbnhap.Text = tbnhap.Text & " "
End Select
Else
'xu ly cua phan Adjust Ring Volume
If advolume = True Then
i = i + 1
If vol < 7 Then
Select Case i
Case 3, 6, 9, 12, 15, 18, 21
vol = vol + 1
volume.Picture = volume1(vol).Picture
End Select
Else
Beep
End If
Exit Sub
End If
End If
'****** day la phan xu ly cua phim OnOff *******
Case 16
phonebook = False
quickaccess = False
message1 = False
setup = False
network = False
listdial = False
editentrylist = False
addentrylist = False
eraseentrylist = False
changecase = False
messagelist = False
taomoi = False
editor = False
availablenetwork = False
addnetwork = False
Image2.Visible = False
Select Case onoff
Case 0
screen.Visible = True
Frame1.Visible = False
tbnhap.Visible = False
If volume.Visible = True Then
volume.Visible = False
Frame1.Height = 500
Frame1.Width = 1800
End If
onoff = 1
Exit Sub
Case 1
screen.Visible = False
Frame1.Visible = True
tbnhap.Visible = True
If autolocked = True Or locked = True Then
tbnhap.Text = "Locked"
Else
tbnhap.Text = "Menu"
End If
onoff = 0
Exit Sub
End Select
'phan xu ly cua menu quick access
Case 17
If locked = True Then
Exit Sub
End If
If volume.Visible = True Then 'And so(14).Value = False And so(15).Value = False Then
volume.Visible = False
tbnhap.Visible = True
Frame1.Height = 500
Frame1.Width = 1800
End If
Image2.Visible = False
network = False
phonebook = False
setup = False
listdial = False
editentrylist = False
addentrylist = False
eraseentrylist = False
changecase = False
messagelist = False
taomoi = False
editor = False
availablenetwork = False
addnetwork = False
Open filename3 For Random As #1 Len = Len(menuaccess)
Get #1, 1, menuaccess
tbnhap.Text = Trim(menuaccess.feature)
orderinquick = 1
luumuc = menuaccess.thutu
quickaccess = True
phonebook = False
thu = True
danhso = False
cancle = False
Close #1
Exit Sub
End Select
End Sub
'****** CHUONG TRINH CON THEM SO DT MOI *****
Private Sub add_entry(st As String, nu As String, lo As Integer, flag As Boolean)
Dim news As entry
Dim banghi As Byte
Dim j As Byte
If addentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
Else
Open filename For Random As #1 Len = Len(news)
End If
banghi = LOF(1) \ Len(news)
For j = 1 To banghi
Get #1, j, news
If news.location = lo Then
tbnhap.Text = "Overwritten?"
Close #1
Exit Sub
End If
Next j
news.name = st
news.number = nu
news.location = lo
banghi = banghi + 1
If addentrylist = True Then
Put #1, banghi, news
Else
If flag = True Then
Put #1, banghi, news
Else
Put #1, banghi, news
End If
End If
addentrylist = False
listdial = False
tbnhap.Text = "Stored" & Str(lo)
Close #1
End Sub
'**** THU TUC TIM VI TRI SE GHI MOT MUC KHI USER KHONG NHAP VAO LOCATION ****
Private Function add_lo(co As Boolean) As Integer
Dim news As entry
Dim banghi As Byte
Dim j As Integer
Dim i As Integer
Dim timthay As Boolean
If co = True Then
i = 1
If addentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
Else
Open filename For Random As #1 Len = Len(news)
End If
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
add_lo = 1
timthay = False
Close #1
Else
timthay = True
End If
Do While timthay = True
For j = 1 To banghi
Get #1, j, news
If i = news.location Then
i = i + 1
timthay = True
Exit For
Else
If j = banghi Then
add_lo = i
timthay = False
Close #1
Exit Do
End If
End If
Next j
Loop
Else
i = 101
Open filename For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
add_lo = 101
timthay = False
Else
timthay = True
End If
Do While timthay = True
For j = 1 To banghi
Get #1, j, news
If i = news.location Then
i = i + 1
timthay = True
Exit For
Else
If j = banghi Then
add_lo = i
timthay = False
Close #1
Exit Do
End If
End If
Next j
Loop
Close #1
End If
End Function
'***** CHUONG TRINH CON TIM SO DT THEO TEN ******
Private Sub find_name(ten As String)
Dim news As entry
Dim i As Integer
Dim j As Integer
Dim banghi As Integer
Select Case prevent
Case 1
Open filename For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
Case 2, 3
Open filename2 For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
Case 4
found = False
tbnhap.Text = "No Name Stored"
Exit Sub
End Select
'**** Truong hop khong co ten nao da duoc luu ****
If banghi = 0 Then
found = False
tbnhap.Text = "No Name Stored"
Close #1
Exit Sub
End If
'**** truong hop user khong nhap ten de tim ********
If ten = "" And banghi 0 Then
Get #1, 1, news
found = True
vitri = 1
st1 = news.name
st = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
Close #1
flag = True
Exit Sub
'truong hop ten nhap vao trung voi ten da luu
Else
For i = 1 To banghi
Get #1, i, news
If StrComp(Left(news.name, Len(ten)), ten) = 0 Then
found = True
vitri = i
st = news.name
nu = news.number
st1 = news.name
tbnhap.Text = st & vbCrLf & nu
flag = True
Close #1
Exit Sub
End If
Next i
End If
'truong hop ten nhap vao khong trung voi ten da luu
For i = 1 To banghi
Get #1, i, news
If StrComp(Left(news.name, 1), Left(ten, 1)) = 0 Then
found = True
vitri = i
st = news.name
nu = news.number
st1 = news.name
tbnhap.Text = st & vbCrLf & nu
flag = True
Close #1
Exit Sub
End If
Next i
'truong hop ten nhap vao khong tin thay, lay entry dau tien
Get #1, 1, news
st1 = news.name
st = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
found = True
flag = True
vitri = 1
Close #1
End Sub
'***** THU TUC GHI DE KHI TRUNG VI TRI *****
Private Sub OVERWRITE(st As String, nu As String, lo As Integer)
Dim j As Integer
Dim news As entry
Dim banghi As Byte
If addentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
addentrylist = False
Else
Open filename For Random As #1 Len = Len(news)
End If
banghi = LOF(1) \ Len(news)
For j = 1 To banghi
Get #1, j, news
If news.location = lo Then
news.location = lo
news.number = nu
news.name = st
Put #1, j, news
tbnhap.Text = "Stored" & Str(lo)
Exit For
End If
Next j
Close #1
End Sub
'****** THU TUC TIM MOT MUC THEO VI TRI *****
Private Sub find_location(so As Integer)
Dim news As entry
Dim news1 As entry
Dim j As Integer
Dim banghi As Byte
Dim i As Integer
'found = True
Select Case prevent
Case 1
Open filename For Random As #1 Len = Len(news)
Case 2, 3
Open filename2 For Random As #1 Len = Len(news)
Case 4
tbnhap.Text = "No Number Stored"
Exit Sub
End Select
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
tbnhap.Text = "No Numbers Stored"
Close #1
Exit Sub
End If
If so = 0 Then
Get #1, 1, news
i = news.location
For j = 2 To banghi
Get #1, j, news1
If i > news1.location Then
i = news1.location
vitri = j
Else
vitri = i
End If
Next j
found = True
flag = True
Get #1, vitri, news
st1 = news.name
tbnhap.Text = news.name & vbCrLf & news.number
Close #1
Exit Sub
Else
For j = 1 To banghi
Get #1, j, news
If so = news.location Then
found = True
vitri = j
Exit For
Else
found = False
End If
Next j
If found = True Then
st1 = news.name
tbnhap.Text = news.name & vbCrLf & news.number
Else
tbnhap.Text = "Location Empty"
End If
End If
flag = True
Close #1
End Sub
'****** THU TUC SUA DOI MOT MUC ***********
Private Sub modify(ten As String, so As String, cho As Integer)
Dim news As entry
Dim banghi As Byte
Dim j As Integer
If editentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
Else
Open filename For Random As #1 Len = Len(news)
End If
Get #1, cho, news
If ten "" Then
If so "" Then
news.name = ten
news.number = so
Put #1, cho, news
Close #1
Else
news.name = ten
Put #1, cho, news
Close #1
End If
Else
If so "" Then
news.number = so
Put #1, cho, news
Close #1
Else
Close #1
End If
End If
If editentrylist = True Then
editentrylist = False
listdial = False
End If
End Sub
'****** THU TUC XOA MOT MUC ************
Private Sub erased(cho As Integer)
Dim news As entry
Dim news1 As entry
Dim banghi As Byte
Dim j As Byte
Dim i As Integer
If eraseentrylist = True Then
Open filefixed For Random As #1 Len = Len(news)
Else
Open filename For Random As #1 Len = Len(news)
End If
Open filename1 For Random As #2 Len = Len(news1)
banghi = LOF(1) \ Len(news)
For j = 1 To banghi
If j cho Then
Get #1, j, news
Put #2, j, news
Else
i = news.location
Exit For
End If
Next j
Do While j < banghi
Get #1, j + 1, news
Put #2, j, news
j = j + 1
Loop
tbnhap.Text = "Erased"
Close #1
Close #2
If eraseentrylist = True Then
Kill filefixed
Name filename1 As filefixed
eraseentrylist = False
listdial = False
Else
Kill filename
Name filename1 As filename
End If
End Sub
'***** THU TUC XU LY CUA PHAN PREVENT ACCESS *******
Private Sub prevent_access(k As Integer)
Dim news As entry
Dim news1 As entry
Dim banghi As Byte
Dim j As Integer
Dim i As Integer
Open filename For Random As #1 Len = Len(news)
Open filename2 For Random As #2 Len = Len(news)
banghi = LOF(1) \ Len(news)
i = 0
Select Case k
Case 1, 4
Close #1
Close #2
Exit Sub
Case 2
For j = 1 To banghi
Get #1, j, news
If news.location < 100 Then
i = i + 1
Put #2, i, news
End If
Next j
Close #1
Open filename1 For Random As #3 Len = Len(news)
For j = 1 To i
Get #2, j, news
Put #3, j, news
Next j
Close #2
Close #3
Kill filename2
Name filename1 As filename2
Case 3
For j = 1 To banghi
Get #1, j, news
If news.location > 100 Then
i = i + 1
Put #2, i, news
End If
Next j
Close #1
Open filename1 For Random As #3 Len = Len(news)
For j = 1 To i
Get #2, j, news
Put #3, j, news
Next j
Close #2
Close #3
Kill filename2
Name filename1 As filename2
End Select
End Sub
'***** THU TUC KHI PHIM BI MAT TIEU DIEM***
Private Sub so_LostFocus(Index As Integer)
i = 0
End Sub
'QUAY SO CHI VOI MOT PHIM
Private Sub onetouch(vitri As Integer)
Dim news As entry
Dim j As Byte
Dim banghi As Byte
Select Case onetouchof
Case 1, 2
Open filename For Random As #1 Len = Len(news)
Case 3
Open filefixed For Random As #1 Len = Len(news)
End Select
If onetouchof = 2 Then
vitri = vitri + 100
End If
banghi = LOF(1) \ Len(news)
For j = 1 To banghi
Get #1, j, news
If news.location = vitri Then
tbnhap.Text = news.number
Exit For
End If
Next j
Close #1
End Sub
'DANH SACH SO CO DINH
Private Sub fixeddiallist()
Dim news As entry
Dim banghi As Byte
Dim i As Integer
Dim j As Integer
Open filefixed For Random As #1 Len = Len(news)
found = False
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
tbnhap.Text = "List Empty"
Else
If banghi = 1 Then
Get #1, 1, news
vitri = 1
Else
Get #1, 1, news
i = news.location
For j = 2 To banghi
Get #1, j, news
If i > news.location Then
i = news.location
vitri = j
Else
vitri = i
End If
Next j
End If
listdial = True
Get #1, vitri, news
st1 = news.name
tbnhap.Text = news.name & vbCrLf & news.number
End If
Close #1
End Sub
'XU LY CUA BO DEM THOI GIAN
Private Sub Timer1_Timer()
Dim j As Integer
Dim i As Integer
Dim ch As String
Dim networks As netselect
If formattime = False Then
Label2.Caption = Format(Now, "medium time")
Else
Label2.Caption = Format(Now, "short time")
End If
If Left(tbnhap.Text, 11) = "Range 1-100" Or Left(tbnhap.Text, 13) = "Range 101-255" Or Left(tbnhap.Text, 10) = "Range 1-40" Then
danhso = True
tbnhap.Text = "Enter Location!" & vbCrLf
Exit Sub
End If
If Left(tbnhap.Text, 6) = " Range" Then
danhso = True
tbnhap.Text = " Enter Location" & vbCrLf
Exit Sub
End If
If tbnhap.Text = "Location Empty" Then
'cancle = True
danhso = False
tbnhap.Text = "Personal Number"
Exit Sub
End If
If Right(tbnhap.Text, Len("Unused Locations")) = "Unused Locations" Then
tbnhap.Text = "Menu"
Exit Sub
End If
If tbnhap.Text = "Restricted" Then
tbnhap.Text = "Menu"
Exit Sub
End If
If tbnhap.Text = "Completed" Then
tbnhap.Text = "Menu"
danhso = True
Exit Sub
End If
If tbnhap.Text = "Calling" Then
Timer1.Interval = 3000
If cancall = True Then
tbnhap.Text = "Connecting Failed"
Image2.Visible = False
cancall = False
Exit Sub
End If
tbnhap.Text = "Connected"
Exit Sub
End If
If tbnhap.Text = "Connected" Then
tbnhap.Text = "End Call?"
found = False
Exit Sub
End If
If Left(tbnhap.Text, 6) = "Erased" Then
tbnhap.Text = "Menu"
Exit Sub
End If
If Left(tbnhap.Text, 6) = "Stored" Then
tbnhap.Text = "Menu"
Exit Sub
End If
If tbnhap.Text = "Range 1-24" Then
cancle = False
danhso = True
tbnhap.Text = "Enter Time" & vbCrLf
Exit Sub
End If
If tbnhap.Text = "Invalid Format" Then
cancle = False
danhso = True
tbnhap.Text = "Enter Date" & vbCrLf
Exit Sub
End If
If tbnhap.Text = "Not Match" Then
danhso = True
tbnhap.Text = "Unlock Code" & vbCrLf
Exit Sub
End If
If tbnhap.Text = " Not Match" Then
danhso = True
tbnhap.Text = "Old Code" & vbCrLf
Exit Sub
End If
If tbnhap.Text = "Not Match." Then
danhso = True
tbnhap.Text = "Enter PIN2 Code" & vbCrLf
Exit Sub
End If
If tbnhap.Text = " Not Match." Then
danhso = True
tbnhap.Text = "Enter Barring Password" & vbCrLf
Exit Sub
End If
If tbnhap.Text = "Finding" Then
tbnhap.Text = "Failed"
Exit Sub
End If
If tbnhap.Text = "Failed" Then
tbnhap.Text = "Network Selection"
Exit Sub
End If
If tbnhap.Text = "Enter 4 Digit" Then
tbnhap.Text = "New Code" & vbCrLf
danhso = True
Exit Sub
End If
If tbnhap.Text = "Invalid Code" Then
tbnhap.Text = "Current Code" & vbCrLf
danhso = True
Exit Sub
End If
If tbnhap.Text = " Invalid Code" Then
tbnhap.Text = "Current PIN2 Code" & vbCrLf
danhso = True
End If
If tbnhap.Text = "Invalid Password" Then
tbnhap.Text = " Current Password" & vbCrLf
danhso = True
Exit Sub
End If
If tbnhap.Text = " Enter 4 Digit" Then
tbnhap.Text = "New Barring Password" & vbCrLf
danhso = True
Exit Sub
End If
If tbnhap.Text = "Enter 4-8 Digit" Then
tbnhap.Text = "New PIN2 Code" & vbCrLf
danhso = True
End If
If tbnhap.Text = "Enter 6 Digit" Then
tbnhap.Text = "New Security Code" & vbCrLf
danhso = True
Exit Sub
End If
If tbnhap.Text = " Failed" Then
tbnhap.Text = "Enter Security Code" & vbCrLf
danhso = True
Exit Sub
End If
If tbnhap.Text = "Invalid Time" Then
tbnhap.Text = "Enter Time" & vbCrLf
danhso = False
cancle = False
Exit Sub
End If
If tbnhap.Text = "Invalid Date" Then
tbnhap.Text = "Enter Date" & vbCrLf
cancle = False
danhso = False
Exit Sub
End If
If tbnhap.Text = "Sending" Then
If cancall = True Then
tbnhap.Text = "Connecting Failed"
Image2.Visible = False
cancall = False
Else
tbnhap.Text = " Connected"
End If
Exit Sub
End If
If tbnhap.Text = " Connected" Then
Image2.Visible = False
tbnhap.Text = "Completed"
Exit Sub
End If
If tbnhap.Text = "Deleted" Then
tbnhap.Text = "Messages"
cancle = True
danhso = False
Exit Sub
End If
If tbnhap.Text = "Invalid Msg Number" Then
tbnhap.Text = "Messages"
cancle = True
danhso = False
Exit Sub
End If
'xu ly khi lam trong muc available network
If tbnhap.Text = "Wait.." Then
tbnhap.Text = "Scanning"
Exit Sub
End If
If tbnhap.Text = "Scanning" Then
Open filename5 For Random As #1 Len = Len(networks)
Get #1, 1, networks
tam1 = 1
tbnhap.Text = networks.mang
st = tbnhap.Text
Close #1
Exit Sub
End If
If tbnhap.Text = "Register" Then
tbnhap.Text = "Completed"
Exit Sub
End If
If tbnhap.Text = "Registerring" Then
tbnhap.Text = "Failed"
Exit Sub
End If
End Sub
'THU TUC SAP THU TU
Private Sub sapthutu()
Dim news As entry
Dim news1 As entry
Dim j As Integer
Dim k As Integer
Dim banghi As Byte
Dim ch As String
Dim ch1 As String
Dim so As String
Dim vitri As Integer
Open filename For Random As #1 Len = Len(news)
Open filename For Random As #2 Len = Len(news1)
banghi = LOF(1) \ Len(news)
For j = 2 To banghi
Get #1, j, news
ch = news.name
so = news.number
vitri = news.location
For k = j - 1 To 1 Step -1
Get #2, k, news1
ch1 = news1.name
If StrComp(ch, ch1) = 1 Or StrComp(ch, ch1) = 0 Then
Exit For
End If
news.name = news1.name
news.number = news1.number
news.location = news1.location
Put #1, k + 1, news
Next k
news.name = ch
news.number = so
news.location = vitri
Put #1, k + 1, news
Next j
Close #1
Close #2
End Sub
'CHUYEN MOT MUC
Private Sub menu_downswitchentry()
Dim news As entry
Dim banghi As Byte
Select Case prevent
Case 1
Open filename For Random As #1 Len = Len(news)
Case 2, 3
Open filename2 For Random As #1 Len = Len(news)
End Select
banghi = LOF(1) \ Len(news)
menucon = True
vitri = vitri + 1
If vitri <= banghi Then
Get #1, vitri, news
st1 = news.name
st = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
Close #1
Exit Sub
Else
vitri = 1
Get #1, vitri, news
st = news.name
st1 = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
Close #1
End If
End Sub
'CHUYEN MOT MUC
Private Sub menu_upswitchentry()
Dim news As entry
Dim banghi As Byte
Select Case prevent
Case 1
Open filename For Random As #1 Len = Len(news)
Case 2, 3
Open filename2 For Random As #1 Len = Len(news)
End Select
banghi = LOF(1) \ Len(news)
menucon = True
vitri = vitri - 1
cancle = True
danhso = False
If vitri >= 1 Then
Get #1, vitri, news
st1 = news.name
st = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
Close #1
Exit Sub
Else
vitri = banghi 'vitri + 1
Get #1, vitri, news
st1 = news.name
st = news.name
nu = news.number
tbnhap.Text = st & vbCrLf & nu
Close #1
End If
End Sub
'DI CHUYEN GIUA CAC MUC TRONG DANH SACH SO CO DINH
Private Sub menu_downlistdial()
Dim news As entry
Dim banghi As Byte
Open filefixed For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
listdial = False
Close #1
Exit Sub
End If
vitri = vitri + 1
If vitri <= banghi Then
Get #1, vitri, news
tbnhap.Text = news.name & vbCrLf & news.number
Else
vitri = 1
Get #1, vitri, news
tbnhap.Text = news.name & vbCrLf & news.number
End If
Close #1
End Sub
'DI CHUYEN GIUA CAC MUC TRONG DANH SACH SO CO DINH
Private Sub menu_uplistdial()
Dim news As entry
Dim banghi As Byte
Open filefixed For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
listdial = False
Close #1
Exit Sub
End If
vitri = vitri - 1
If vitri >= 1 Then
Get #1, vitri, news
tbnhap.Text = news.name & vbCrLf & news.number
Else
vitri = banghi
Get #1, vitri, news
tbnhap.Text = news.name & vbCrLf & news.number
End If
Close #1
End Sub
'THU TUC KIEM TRA BO NHO
Private Sub check(so As Boolean)
Dim news As entry
Dim banghi As Byte
Dim j As Integer
Dim max As Integer
Dim max1 As Integer
Open filename For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
For j = 1 To banghi
Get #1, j, news
If news.location < 100 Then
max = max + 1
Else
max1 = max1 + 1
End If
Next j
If so = 0 Then
tbnhap.Text = (100 - max) & " Unused Locations"
Else
tbnhap.Text = (155 - max1) & " Unused Locations"
End If
Close #1
End Sub
'DI CHYEN GIUA DANH SACH CAC MANG UU TIEN
Private Sub preferredlist(so As Integer, chuoi As String)
Dim networks As netselect
Dim banghi As Byte
Dim j As Integer
Open filename6 For Random As #1 Len = Len(networks)
Open filetam For Random As #2 Len = Len(networks)
banghi = LOF(1) \ Len(networks)
If banghi = 0 Then
networks.mang = chuoi
Put #2, 1, networks
Else
For j = 1 To banghi
If so j Then
Get #1, j, networks
Put #2, j, networks
Else
networks.mang = chuoi
Put #2, j, networks
Exit For
End If
Next j
Do While j <= banghi
Get #1, j, networks.mang
Put #2, j + 1, networks.mang
j = j + 1
Loop
End If
If lo > banghi Then
networks.mang = st
Put #2, banghi + 1, networks
End If
Close #1
Close #2
Kill filename6
Name filetam As filename6
End Sub
'THU TUC DI CHUYEN MOT MANG UU TIEN DEN VI TRI MOI
Private Sub movenew(oldlo As Integer, newlo As Integer)
Dim networks As netselect
Dim i As Integer
Dim banghi As Integer
Dim chuoi As String
Open filename6 For Random As #1 Len = Len(networks)
Open filetam For Random As #2 Len = Len(networks)
banghi = LOF(1) \ Len(networks)
If oldlo = newlo Then
Close #1
Close #2
tbnhap.Text = "Completed"
Exit Sub
End If
If newlo >= banghi Then
For i = 1 To oldlo - 1
Get #1, i, networks
Put #2, i, networks
Next i
Get #1, oldlo, networks
chuoi = networks.mang
For i = oldlo + 1 To banghi
Get #1, i, networks
Put #2, i - 1, networks
Next i
networks.mang = chuoi
Put #2, banghi, networks.mang
End If
If oldlo < newlo And newlo < banghi Then
For i = 1 To oldlo - 1
Get #1, i, networks
Put #2, i, networks
Next i
Get #1, oldlo, networks
chuoi = networks.mang
For i = oldlo + 1 To newlo
Get #1, i, networks
Put #2, i - 1, networks
Next i
networks.mang = chuoi
Put #2, newlo, networks.mang
i = newlo + 1
Do While i <= banghi
Get #1, i, networks
Put #2, i, networks
i = i + 1
Loop
End If
If oldlo > newlo Then
For i = 1 To newlo - 1
Get #1, i, networks
Put #2, i, networks
Next i
Get #1, oldlo, networks
Put #2, newlo, networks
For i = newlo To oldlo - 1
Get #1, i, networks
Put #2, i + 1, networks
Next i
i = oldlo + 1
Do While i <= banghi
Get #1, i, networks
Put #2, i, networks
i = i + 1
Loop
End If
Close #1
Close #2
Kill filename6
Name filetam As filename6
tbnhap.Text = "Completed"
End Sub
'THU TUC XOA MOT MANG UU TIEN
Private Sub xoa(loca As Integer)
Dim networks As netselect
Dim j As Integer
Dim i As Integer
Dim banghi As Byte
Open filename6 For Random As #1 Len = Len(networks)
Open filetam For Random As #2 Len = Len(networks)
banghi = LOF(1) \ Len(networks)
For j = 1 To banghi
If j loca Then
Get #1, j, networks
Put #2, j, networks
Else
Exit For
End If
Next j
Do While j < banghi
Get #1, j + 1, networks
Put #2, j, networks
j = j + 1
Loop
Close #1
Close #2
Kill filename6
Name filetam As filename6
tbnhap.Text = "Completed"
End Sub
'**** Ham dung phim so trong menu Quick Access *****
Private Function clickquickaccess(so As Integer) As Integer
Dim menuaccess As access
Open filename3 For Random As #1 Len = Len(menuaccess)
Get #1, so, menuaccess
tbnhap.Text = Trim(menuaccess.feature)
clickquickaccess = menuaccess.thutu
'orderinquick = 1
Close #1
End Function
'**** Thu tuc dung phim trong menu Message list
Private Sub clickmessage(so As Integer)
Dim message As messages
Dim banghi As Byte
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
If banghi < so Then
tbnhap.Text = "Invalid Msg Number"
messagelist = False
Else
Get #1, so, message
tbnhap.Text = Trim(message.tin)
messagenumber = 2
End If
Close #1
End Sub
Private Sub store_message()
Dim message As messages
Dim banghi As Byte
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
If taomoi = True Then
banghi = banghi + 1
message.tin = st
message.sothutu = banghi 'messagenumber
Put #1, banghi, message 'messagenumber
Else
Get #1, messagenumber, message
message.tin = st
Put #1, messagenumber, message
End If
tbnhap.Text = "Stored"
'message1 = False
Close #1
End Sub
Private Sub delete_message()
Dim message As messages
Dim banghi As Byte
Dim j As Integer
Open filename4 For Random As #1 Len = Len(message)
banghi = LOF(1) \ Len(message)
Open filetam For Random As #2 Len = Len(message)
For j = 1 To banghi
If j messagenumber Then
Get #1, j, message
Put #2, j, message
Else
Exit For
End If
Next j
Do While j < banghi
Get #1, j + 1, message
Put #2, j, message
j = j + 1
Loop
tbnhap.Text = "Deleted"
Close #1
Kill filename4
Close #2
Name filetam As filename4
End Sub
'KHOI TAO CONTROL
Private Sub UserControl_Initialize()
Dim news As entry
Dim banghi As Integer
Dim menuaccess As access
Dim k As Integer
Dim message As messages
Dim networks As netselect
Label2.Caption = Left(Time, 5)
tbnhap.Text = "Menu"
unlocked = "1234"
securitycode = "000000"
voicemailnumber = "4321"
servicecentre = "130"
pin2code = "13579"
expiryperiod = "24"
barpassword = "6789"
volume.Picture = volume1(2).Picture
vol = 3
prevent = 1
Open filename3 For Random As #1 Len = Len(menuaccess)
menuaccess.feature = "Find Name?"
menuaccess.thutu = 1
Put #1, 1, menuaccess
menuaccess.feature = "Add to SIM?"
menuaccess.thutu = 4
Put #1, 2, menuaccess
menuaccess.feature = "Call Voicemail?"
menuaccess.thutu = 12
Put #1, 3, menuaccess
menuaccess.feature = "Battery Meter?"
menuaccess.thutu = 11
Put #1, 4, menuaccess
menuaccess.feature = "Show Time/Date?"
menuaccess.thutu = 8
Put #1, 5, menuaccess
menuaccess.feature = "Adjust Ring?"
menuaccess.thutu = 6
Put #1, 6, menuaccess
menuaccess.feature = "Switch Line 1/2?"
menuaccess.thutu = 7
Put #1, 7, menuaccess
menuaccess.feature = "Vibrate On/Off?"
menuaccess.thutu = 9
Put #1, 8, menuaccess
menuaccess.feature = "Change Band?"
menuaccess.thutu = 10
Put #1, 9, menuaccess
Close #1
Open filename For Random As #1 Len = Len(news)
news.name = "NHA"
news.number = "8402631"
news.location = 1
Put #1, 1, news
news.name = "HUNG"
news.number = "8570726"
news.location = 101
Put #1, 2, news
Close #1
Open filename4 For Random As #2 Len = Len(message)
message.tin = "HELLO"
message.sothutu = 1
Put #2, 1, message
Close #2
Open filename5 For Random As #1 Len = Len(networks)
networks.mang = "FPT"
Put #1, 1, networks
networks.mang = "Phuong Nam"
Put #1, 2, networks
networks.mang = "SaigonNet"
Put #1, 3, networks
networks.mang = "VNN"
Put #1, 4, networks
Close #1
Open filefixed For Random As #1 Len = Len(news)
banghi = LOF(1) \ Len(news)
If banghi = 0 Then
news.name = "NHA"
news.number = "8402631"
news.location = 1
Put #1, 1, news
End If
Close #1
Open filename6 For Random As #1 Len = Len(networks)
banghi = LOF(1) \ Len(networks)
If banghi = 0 Then
networks.mang = "FPT"
Put #1, 1, networks
End If
Close #1
End Sub
'KHI CONTROL KET THUC
Private Sub UserControl_Terminate()
Kill filename
Kill filename3
Kill filename4
Kill filename5
Kill filename6
Kill filefixed
End Sub
PHAÀN IV:
KEÁT LUAÄN
Vôùi nhöõng kieán thöùc laõnh hoäi ñöôïc ôû tröôøng vaø söï giuùp ñôõ cuûa caùc Thaày, Coâ trong khoa coâng ngheä thoâng tin tröôøng Ñaïi Hoïc Kyõ Thuaät Thaønh Phoá Hoà Chí Minh. Vaø söï höôùng daãn giuùp ñôõ taän tình cuûa thaày Nguyeãn Cao Trí, ñeán ñaây chuùng em xin hoaøn thaønh luaän vaên cuûa mình.
Tuy luaän vaên hoaøn thaønh chöa ñöôïc lôùn lao gì, nhöng em cuõng hy voïng luaän vaên naøy cuõng laø moät phaàn taøi lieäu tham khaûo nho nhoû giuùp cho nhöõng ngöôøi hoïc vaø laäp trình Web vôùi Visual Basic.
PHAÀN V :
TAØI LIEÄU THAM KHAÛO
Kyõ naêng laäp trình Visual Basic 6.0.
Microsoft Developer Network.
Các file đính kèm theo tài liệu này:
- Lập trình Web bằng Visual Basic.doc