24/05/2018, 20:33

Mã nguồn của ActiveX Control (part2)

tbnhap.Text = "Add Entry to Phone" st = "Add to Phone?" luumuc = 3 Exit Sub End If If tbnhap.Text = "Call VoiceMail" Then tbnhap.Text = "Add Entry to SIM" st = "Add to SIM?" ...

tbnhap.Text = "Add Entry to Phone"

st = "Add to Phone?"

luumuc = 3

Exit Sub

End If

If tbnhap.Text = "Call VoiceMail" Then

tbnhap.Text = "Add Entry to SIM"

st = "Add to SIM?"

luumuc = 4

Exit Sub

End If

If tbnhap.Text = "Battery Meter" Then

tbnhap.Text = "Call VoiceMail"

st = "Call Voicemail?"

luumuc = 12

Exit Sub

End If

If tbnhap.Text = "Phone Lock Now" Then

tbnhap.Text = "Battery Meter"

st = "Battery Meter?"

luumuc = 11

Exit Sub

End If

If tbnhap.Text = "Ring Volume" Then

tbnhap.Text = "Phone Lock Now"

st = "Lock Now?"

luumuc = 5

Exit Sub

End If

If tbnhap.Text = "VibraCall On or Off" Then

tbnhap.Text = "Ring Volume"

st = "Adjust Ring?"

luumuc = 6

Exit Sub

End If

If tbnhap.Text = " Outgoing Messages" Then

tbnhap.Text = "VibraCall On or Off"

st = "Vibrate On/Off?"

luumuc = 9

Exit Sub

End If

If tbnhap.Text = " Message Editor" Then

tbnhap.Text = " Outgoing Messages"

st = "Outgoing SMS?"

luumuc = 14

Exit Sub

End If

If tbnhap.Text = "Switch Line 1/2" Then

tbnhap.Text = " Message Editor"

st = "Message Editor?"

luumuc = 15

Exit Sub

End If

If tbnhap.Text = "Change Band" Then

tbnhap.Text = "Switch Line 1/2"

st = "Switch Line 1/2?"

luumuc = 7

Exit Sub

End If

If tbnhap.Text = " Show Time and Date" Then

tbnhap.Text = "Change Band"

st = "Change Band?"

luumuc = 10

Exit Sub

End If

If tbnhap.Text = "Find by Name" Then

tbnhap.Text = " Show Time and Date"

st = "Show Time/Date?"

luumuc = 8

Exit Sub

End If

End If

'phan xu ly khi dung phim menu de di chuyen giua cac muc con

If found = True Then

Call menu_upswitchentry

End If

'khi dung phim menu de di chuyen giua nhung muc trong Fixed Dial

If listdial = True Then

Call menu_uplistdial

End If

'xu ly khi dung phim menu de di chuyen giua cac mang

If availablenetwork = True Or addnetwork = True Then

tam1 = tam1 - 1

Open filename5 For Random As #1 Len = Len(networks)

banghi = LOF(1) Len(networks)

If tam1 >= 1 Then

Get #1, tam1, networks

tbnhap.Text = networks.mang

st = networks.mang

Close #1

Else

tam1 = banghi

Get #1, banghi, networks

tbnhap.Text = networks.mang

st = networks.mang

Close #1

End If

Exit Sub

End If

'xu ly cua muc Preferred network

If showlist = True Then

Open filename6 For Random As #1 Len = Len(networks)

banghi = LOF(1) Len(networks)

tam1 = tam1 - 1

If tam1 >= 1 Then

Get #1, tam1, networks

tbnhap.Text = networks.mang

st = networks.mang

Else

tam1 = banghi

Get #1, banghi, networks

tbnhap.Text = networks.mang

st = networks.mang

End If

Close #1

Exit Sub

End If

'********** phim menu-down ************

Case 12

If tbnhap.Text = "Menu" Then

tbnhap.Text = "Phone Book"

cancle = True

danhso = False

Exit Sub

End If

If tbnhap.Text = "Phone Book" Then

tbnhap.Text = "Call Related Features"

Exit Sub

End If

If tbnhap.Text = "Call Related Features" Then

tbnhap.Text = "Messages"

Exit Sub

End If

If tbnhap.Text = "Messages" Then

tbnhap.Text = "Phone Setup"

Exit Sub

End If

If tbnhap.Text = "Phone Setup" Then

tbnhap.Text = "Network Selection"

Exit Sub

End If

If tbnhap.Text = "Network Selection" Then

tbnhap.Text = "Accessory Setup"

Exit Sub

End If

If tbnhap.Text = "Accessory Setup" Then

tbnhap.Text = "Phone Book"

Exit Sub

End If

'vao menu con cua muc Phone Book

If tbnhap.Text = "Personal Number" Then

tbnhap.Text = "Fixed Dialling"

Exit Sub

End If

If tbnhap.Text = "Fixed Dialling" Then

tbnhap.Text = "One-Touch Dial Setting"

Exit Sub

End If

If tbnhap.Text = "One-Touch Dial Setting" Then

tbnhap.Text = "Personal Number"

Exit Sub

End If

'vao menu con cua muc Personal Number

If tbnhap.Text = "Find Entry by Name" Then

tbnhap.Text = "Find Entry by Location"

Exit Sub

End If

If tbnhap.Text = "Find Entry by Location" Then

tbnhap.Text = "Add Entry"

flag = False

found = False

Exit Sub

End If

If tbnhap.Text = "Add Entry" Then

tbnhap.Text = "Check Capacity"

Exit Sub

End If

If tbnhap.Text = "Check Capacity" Then

tbnhap.Text = "Prevent Access"

Exit Sub

End If

If tbnhap.Text = "Prevent Access" Then

tbnhap.Text = "Find Entry by Name"

Exit Sub

End If

'vao menu con cua muc Prevent Access

If tbnhap.Text = "No Memory Restrictions" Then

tbnhap.Text = "To SIM Card Memory"

Exit Sub

End If

If tbnhap.Text = "To SIM Card Memory" Then

tbnhap.Text = "To Phone Memory"

Exit Sub

End If

If tbnhap.Text = "To Phone Memory" Then

tbnhap.Text = "To Phone & SIM Memory"

Exit Sub

End If

If tbnhap.Text = "To Phone & SIM Memory" Then

tbnhap.Text = "No Memory Restrictions"

Exit Sub

End If

'vao menu con cua muc Add Entry

If tbnhap.Text = "Add To Phone Memory" Then

tbnhap.Text = "Add To SIM Card Memory"

Exit Sub

End If

If tbnhap.Text = "Add To SIM Card Memory" Then

tbnhap.Text = "Add To Phone Memory"

Exit Sub

End If

'vao menu con cua muc Check Capacity

If tbnhap.Text = "Check Phone Capacity" Then

tbnhap.Text = "Check SIM Capacity"

Exit Sub

End If

If tbnhap.Text = "Check SIM Capacity" Then

tbnhap.Text = "Check Phone Capacity"

Exit Sub

End If

'vao menu con cua muc Find Entry

If tbnhap.Text = "Call Number" Then

tbnhap.Text = "Modify Name or Number"

Exit Sub

End If

If tbnhap.Text = "Modify Name or Number" Then

tbnhap.Text = "Erase Name and Number"

Exit Sub

End If

If tbnhap.Text = "Erase Name and Number" Then

tbnhap.Text = "Call Number"

Exit Sub

End If

'phan xu ly khi vao menu One-Touch Dial Setting

If tbnhap.Text = " To SIM Memory" Then

tbnhap.Text = " To Fixed Dial List"

Exit Sub

End If

If tbnhap.Text = " To Phone Memory" Then

tbnhap.Text = " To SIM Memory"

Exit Sub

End If

If tbnhap.Text = " To Fixed Dial List" Then

tbnhap.Text = " To Phone Memory"

Exit Sub

End If

'xu ly cua muc Fixed Dialling

If tbnhap.Text = "View Fixed Dial List" Then

tbnhap.Text = "Setup Fixed Dialling"

Exit Sub

End If

If tbnhap.Text = "Setup Fixed Dialling" Then

tbnhap.Text = "View Fixed Dial List"

Exit Sub

End If

'xu ly trong muc Setup Fixed Dialling

If tbnhap.Text = "On." Then

tbnhap.Text = "Off."

Exit Sub

End If

If tbnhap.Text = "Off." Then

tbnhap.Text = "Edit Entry"

Exit Sub

End If

If tbnhap.Text = " Add Entry" Then

tbnhap.Text = "Erase Entry"

Exit Sub

End If

If tbnhap.Text = "Edit Entry" Then

tbnhap.Text = " Add Entry"

Exit Sub

End If

If tbnhap.Text = "Erase Entry" Then

tbnhap.Text = "On."

Exit Sub

End If

'phan xu ly cua menu Call Related features

If tbnhap.Text = "Call Barring" Then

tbnhap.Text = "Key Answer Only"

Exit Sub

End If

If tbnhap.Text = "Call Waiting" Then

tbnhap.Text = "Call Barring"

Exit Sub

End If

If tbnhap.Text = "Talk and Fax" Then

tbnhap.Text = "Call Waiting"

Exit Sub

End If

If tbnhap.Text = "Call Diverting" Then

tbnhap.Text = "Talk and Fax"

Exit Sub

End If

If tbnhap.Text = "Restrict My Phone Number" Then

tbnhap.Text = "Call Diverting"

Exit Sub

End If

If tbnhap.Text = "Show Battery Meter" Then

tbnhap.Text = "Restrict My Phone Number"

Exit Sub

End If

If tbnhap.Text = "Key Answer Only" Then

tbnhap.Text = "Show Battery Meter"

Exit Sub

End If

'vao menu con cua muc Restrict My Phone Number

If tbnhap.Text = "Show ID On Next Call" Then

tbnhap.Text = "Restrict ID On Next Call"

Exit Sub

End If

If tbnhap.Text = "Restrict ID On Next Call" Then

tbnhap.Text = "Show ID On Next Call"

Exit Sub

End If

'vao menu con cua muc Call Diverting

If tbnhap.Text = "Cancel All Diverting" Then

tbnhap.Text = "Divert Voice Calls"

Exit Sub

End If

If tbnhap.Text = "Divert Data Calls" Then

tbnhap.Text = "Cancel All Diverting"

Exit Sub

End If

If tbnhap.Text = "Divert Fax Calls" Then

tbnhap.Text = "Divert Data Calls"

Exit Sub

End If

If tbnhap.Text = "Divert Voice Calls" Then

tbnhap.Text = "Divert Fax Calls"

Exit Sub

End If

'vao menu con cua muc Divert Voice Calls

If tbnhap.Text = "Detailed Diverting" Then

tbnhap.Text = "Divert When Unavailable"

Exit Sub

End If

If tbnhap.Text = "Divert All Voice Calls" Then

tbnhap.Text = "Detailed Diverting"

Exit Sub

End If

If tbnhap.Text = "Divert When Unavailable" Then

tbnhap.Text = "Divert All Voice Calls"

Exit Sub

End If

'vao menu con cua muc Detailed Diverting

If tbnhap.Text = "If Not Reachable" Then

tbnhap.Text = "If No Answer"

Exit Sub

End If

If tbnhap.Text = "If Busy" Then

tbnhap.Text = "If Not Reachable"

Exit Sub

End If

If tbnhap.Text = "If No Answer" Then

tbnhap.Text = "If Busy"

Exit Sub

End If

'vao menu con cua muc Call Barring

If tbnhap.Text = "Bar Incoming Calls" Then

tbnhap.Text = "Cancel All Barring"

Exit Sub

End If

If tbnhap.Text = "Bar Outgoing Calls" Then

tbnhap.Text = "Bar Incoming Calls"

Exit Sub

End If

If tbnhap.Text = "Cancel All Barring" Then

tbnhap.Text = "Change Bar Password"

Exit Sub

End If

If tbnhap.Text = "Change Bar Password" Then

tbnhap.Text = "Bar Outgoing Calls"

Exit Sub

End If

'vao menu con cua muc Bar Outgoing Calls

If tbnhap.Text = "All Calls" Then

tbnhap.Text = "Off?"

Exit Sub

End If

If tbnhap.Text = "Int'l Calls Expect Home" Then

tbnhap.Text = "All Calls"

Exit Sub

End If

If tbnhap.Text = "Int'l Calls" Then

tbnhap.Text = "Int'l Calls Expect Home"

Exit Sub

End If

If tbnhap.Text = "Off?" Then

tbnhap.Text = "Int'l Calls"

Exit Sub

End If

'vao menu con cua muc Bar Incoming Call

If tbnhap.Text = " All Calls" Then

tbnhap.Text = "Off? "

Exit Sub

End If

If tbnhap.Text = "When Roaming" Then

tbnhap.Text = " All Calls"

Exit Sub

End If

If tbnhap.Text = "Off? " Then

tbnhap.Text = "When Roaming"

Exit Sub

End If

'phan xu ly cua menu Message

If tbnhap.Text = "Call Voicemail" Then

tbnhap.Text = "Outgoing Messages"

Exit Sub

End If

If tbnhap.Text = "Outgoing Messages" Then

tbnhap.Text = "Message Editor"

Exit Sub

End If

If tbnhap.Text = "Message Editor" Then

tbnhap.Text = "Cell Broadcast"

Exit Sub

End If

If tbnhap.Text = "Cell Broadcast" Then

tbnhap.Text = "Message Settings"

Exit Sub

End If

If tbnhap.Text = "Message Settings" Then

tbnhap.Text = "Call Voicemail"

Exit Sub

End If

'vao menu con cua muc Outgoing Message

If tbnhap.Text = "Send Message" Then

tbnhap.Text = "Edit Message"

Exit Sub

End If

If tbnhap.Text = "Edit Message" Then

tbnhap.Text = "Delete Message"

Exit Sub

End If

If tbnhap.Text = "Delete Message" Then

tbnhap.Text = "Go to Next Message"

Exit Sub

End If

If tbnhap.Text = "Go to Next Message" Then

tbnhap.Text = "Send Message"

Exit Sub

End If

'vao menu con cua muc Edit Message

If tbnhap.Text = " Send Message" Then

tbnhap.Text = "Store Message"

Exit Sub

End If

If tbnhap.Text = "Store Message" Then

tbnhap.Text = " Send Message"

Exit Sub

End If

'vao menu con cua muc Send Message

If tbnhap.Text = " Enter Number" Then

tbnhap.Text = " Find Entry by Name"

Exit Sub

End If

If tbnhap.Text = " Find Entry by Name" Then

tbnhap.Text = " Find Entry by Location"

Exit Sub

End If

If tbnhap.Text = " Find Entry by Location" Then

tbnhap.Text = " Enter Number"

Exit Sub

End If

'vao menu con cua muc Message Setting

If tbnhap.Text = "Voicemail Number" Then

tbnhap.Text = "Service Centre"

Exit Sub

End If

If tbnhap.Text = "Service Centre" Then

tbnhap.Text = "Expiry Period"

Exit Sub

End If

If tbnhap.Text = "Expiry Period" Then

tbnhap.Text = "Outgoing Message Type"

Exit Sub

End If

If tbnhap.Text = "Outgoing Message Type" Then

tbnhap.Text = "Voicemail Number"

Exit Sub

End If

'vao menu con cua muc Outgoing Message Type

If tbnhap.Text = "Text" Then

tbnhap.Text = "Fax"

Exit Sub

End If

If tbnhap.Text = "Fax" Then

tbnhap.Text = "X400"

Exit Sub

End If

If tbnhap.Text = "X400" Then

tbnhap.Text = "Paging"

Exit Sub

End If

If tbnhap.Text = "Paging" Then

tbnhap.Text = "Email"

Exit Sub

End If

If tbnhap.Text = "Email" Then

tbnhap.Text = "ERMES"

Exit Sub

End If

If tbnhap.Text = "ERMES" Then

tbnhap.Text = "Voice"

Exit Sub

End If

If tbnhap.Text = "Voice" Then

tbnhap.Text = "Text"

Exit Sub

End If

'khi dung phim menu de di chuyen giua cac tin nhan

If messagelist = True Then

Open filename4 For Random As #1 Len = Len(message)

banghi = LOF(1) Len(message)

If messagenumber = banghi Then

Get #1, 1, message

tbnhap.Text = Trim(message.tin)

messagenumber = 1

Else

messagenumber = messagenumber + 1

Get #1, messagenumber, message

tbnhap.Text = Trim(message.tin)

End If

Close #1

Exit Sub

End If

'nhung muc con cua Phone Setup

If tbnhap.Text = "Select Phone Line" Then

tbnhap.Text = "Adjust Ring Volume"

Exit Sub

End If

If tbnhap.Text = "Adjust Ring Volume" Then

tbnhap.Text = "Ring or Vibrate"

Exit Sub

End If

If tbnhap.Text = "Ring or Vibrate" Then

tbnhap.Text = "Set Ringer Tone"

Exit Sub

End If

If line2 = True Then

If tbnhap.Text = "Set Ringer Tone" Then

tbnhap.Text = "Set Ringer Tone 2"

Exit Sub

End If

Else

If tbnhap.Text = "Set Ringer Tone" Then

tbnhap.Text = "Phone Lock"

Exit Sub

End If

End If

If tbnhap.Text = "Set Ringer Tone 2" Then

tbnhap.Text = "Phone Lock"

Exit Sub

End If

If tbnhap.Text = "Phone Lock" Then

tbnhap.Text = "Change SIM PIN2 Code"

Exit Sub

End If

If tbnhap.Text = "Change SIM PIN2 Code" Then

tbnhap.Text = "New Security Code"

Exit Sub

End If

If tbnhap.Text = "New Security Code" Then

tbnhap.Text = "Extended Menus"

Exit Sub

End If

'nhung menu mo rong khi extended menus o trang thai on

If extend = True Then

If tbnhap.Text = "Extended Menus" Then

tbnhap.Text = "Show Time and Date"

Exit Sub

End If

If tbnhap.Text = "Show Time and Date" Then

tbnhap.Text = "Set Time and Date"

Exit Sub

End If

If tbnhap.Text = "Set Time and Date" Then

tbnhap.Text = "Set Time Format"

Exit Sub

End If

If tbnhap.Text = "Set Time Format" Then

tbnhap.Text = "Battery Saving Mode"

Exit Sub

End If

If tbnhap.Text = "Battery Saving Mode" Then

tbnhap.Text = "Select Keypad Tones"

Exit Sub

End If

If tbnhap.Text = "Select Keypad Tones" Then

tbnhap.Text = "Select Phone Line"

Exit Sub

End If

Else

If tbnhap.Text = "Extended Menus" Then

tbnhap.Text = "Select Phone Line"

Exit Sub

End If

End If

'vao menu con cua muc Select phone line

If tbnhap.Text = "Line 1" Then

tbnhap.Text = "Line 2"

Exit Sub

End If

If tbnhap.Text = "Line 2" Then

tbnhap.Text = "Line 1"

Exit Sub

End If

'vao menu con cua muc Ring or vibrate

If tbnhap.Text = "Ring Only" Then

tbnhap.Text = "Vibrate Only"

Exit Sub

End If

If tbnhap.Text = "Vibrate Only" Then

tbnhap.Text = "Vibrate Then Ring"

Exit Sub

End If

If tbnhap.Text = "Vibrate Then Ring" Then

tbnhap.Text = "No Ring or Vibrate"

Exit Sub

End If

If tbnhap.Text = "No Ring or Vibrate" Then

tbnhap.Text = "Ring Only"

Exit Sub

End If

'vao menu con cua muc Set Ringer Tone

If tbnhap.Text = "Standard Tone" Then

tbnhap.Text = "Music Tone"

Exit Sub

End If

If tbnhap.Text = "Music Tone" Then

tbnhap.Text = "Standard Tone"

Exit Sub

End If

'vao menu con cua muc Phone Lock

If tbnhap.Text = "Automatic Lock" Then

tbnhap.Text = "Lock Now"

Exit Sub

End If

If tbnhap.Text = "Lock Now" Then

tbnhap.Text = " Change Unlock Code"

Exit Sub

End If

If tbnhap.Text = " Change Unlock Code" Then

tbnhap.Text = "Automatic Lock"

Exit Sub

End If

'vao menu con cua muc Extended menus

If tbnhap.Text = " On" Then

tbnhap.Text = " Off"

Exit Sub

End If

If tbnhap.Text = " Off" Then

tbnhap.Text = " On"

Exit Sub

End If

If tbnhap.Text = " On " Then

tbnhap.Text = " Off "

Exit Sub

End If

If tbnhap.Text = " Off " Then

tbnhap.Text = " On "

Exit Sub

End If

'vao menu con cua muc Require SIM card pin

If tbnhap.Text = " On." Then

tbnhap.Text = " Off."

Exit Sub

End If

If tbnhap.Text = " Off." Then

tbnhap.Text = "Change SIM PIN Code"

Exit Sub

End If

If tbnhap.Text = "Change SIM PIN Code" Then

tbnhap.Text = " On."

Exit Sub

End If

'vao menu con cua muc Set time format

If tbnhap.Text = "12-hour?" Then

tbnhap.Text = "24-hour?"

Exit Sub

End If

If tbnhap.Text = "24-hour?" Then

tbnhap.Text = "12-hour?"

Exit Sub

End If

'vao menu cua muc Select Keypad tone

If tbnhap.Text = "Normal Tones" Then

tbnhap.Text = "Single Tone"

Exit Sub

End If

If tbnhap.Text = "Single Tone" Then

tbnhap.Text = "No Tones"

Exit Sub

End If

If tbnhap.Text = "No Tones" Then

tbnhap.Text = "Normal Tones"

Exit Sub

End If

'vao menu con cua muc Phone Status

If tbnhap.Text = "Status Review" Then

tbnhap.Text = "Master Reset"

Exit Sub

End If

If tbnhap.Text = "Master Reset" Then

tbnhap.Text = "Master Clear"

Exit Sub

End If

If tbnhap.Text = "Master Clear" Then

tbnhap.Text = "Status Review"

Exit Sub

End If

'phan xu ly cua menu Network Selection

If tbnhap.Text = " Change Band" Then

tbnhap.Text = "Available Networks"

Exit Sub

End If

If tbnhap.Text = "Available Networks" Then

tbnhap.Text = "Network Search"

Exit Sub

End If

If tbnhap.Text = "Network Search" Then

tbnhap.Text = "Preferred Networks"

Exit Sub

End If

If tbnhap.Text = "Preferred Networks" Then

tbnhap.Text = "Find New Network"

Exit Sub

End If

If tbnhap.Text = "Find New Network" Then

tbnhap.Text = " Change Band"

Exit Sub

End If

'vao menu con cua Change Band

If tbnhap.Text = "Change to 900" Then

tbnhap.Text = "Change to 1800"

Exit Sub

End If

If tbnhap.Text = "Change to 900/1800" Then

tbnhap.Text = "Change to 900"

Exit Sub

End If

If tbnhap.Text = "Change to 1800" Then

tbnhap.Text = "Change to 900/1800"

Exit Sub

End If

'vao menu con cua muc Available Networks

If tbnhap.Text = "Register Now" Then

tbnhap.Text = "Make Preferred"

Exit Sub

End If

If tbnhap.Text = "Make Preferred" Then

tbnhap.Text = "Register Now"

Exit Sub

End If

'vao menu con cua muc Network Search

If tbnhap.Text = "Registration Preferences" Then

tbnhap.Text = "Frequency of Search"

Exit Sub

End If

If tbnhap.Text = "Frequency of Search" Then

tbnhap.Text = "Registration Preferences"

Exit Sub

End If

'vao menu con cua muc "Registration Preferences

If tbnhap.Text = "Manual Search Mode" Then

tbnhap.Text = "Automatic Search Mode"

Exit Sub

End If

If tbnhap.Text = "Automatic Search Mode" Then

tbnhap.Text = "Manual Search Mode"

Exit Sub

End If

'vao menu con cua muc Frequency

If tbnhap.Text = "Fast Search" Then

tbnhap.Text = "Continuous Search"

Exit Sub

End If

If tbnhap.Text = "Medium Search" Then

tbnhap.Text = "Fast Search"

Exit Sub

End If

If tbnhap.Text = "Slow Search" Then

tbnhap.Text = "Medium Search"

Exit Sub

End If

If tbnhap.Text = "Continuous Search" Then

tbnhap.Text = "Slow Search"

Exit Sub

End If

'vao menu con cua muc Preferred networks

If tbnhap.Text = "Add Network to List" Then

tbnhap.Text = "Show List of Networks"

Exit Sub

End If

If tbnhap.Text = "Show List of Networks" Then

tbnhap.Text = "Add Network to List"

Exit Sub

End If

If tbnhap.Text = "Choose From Available" Then

tbnhap.Text = "Choose From Known"

Exit Sub

End If

If tbnhap.Text = "Choose From Known" Then

tbnhap.Text = "Choose From Available"

Exit Sub

End If

If tbnhap.Text = "Move to New Location" Then

tbnhap.Text = "Delete Network"

Exit Sub

End If

If tbnhap.Text = "Delete Network" Then

tbnhap.Text = "Move to New Location"

Exit Sub

End If

'phan xu ly cua menu Accessory setup

If tbnhap.Text = "Mute Car Radio" Then

tbnhap.Text = "Automatic Answer"

Exit Sub

End If

If tbnhap.Text = "Automatic Answer" Then

tbnhap.Text = "Automatic Handsfree"

Exit Sub

End If

If tbnhap.Text = "Automatic Handsfree" Then

tbnhap.Text = "Safety Timer"

Exit Sub

End If

If tbnhap.Text = "Safety Timer" Then

tbnhap.Text = "Auxiliary Alert"

Exit Sub

End If

If tbnhap.Text = "Auxiliary Alert" Then

tbnhap.Text = "Mute Car Radio"

Exit Sub

End If

If tbnhap.Text = "On" Then

tbnhap.Text = "Off"

Exit Sub

End If

If tbnhap.Text = "Off" Then

tbnhap.Text = "On"

Exit Sub

End If

'phan xu ly khi vao menu truy cap nhanh

If quickaccess = True Then

Open filename3 For Random As #1 Len = Len(menuaccess)

orderinquick = orderinquick + 1

Get #1, orderinquick, menuaccess

tbnhap.Text = Trim(menuaccess.feature)

luumuc = menuaccess.thutu

If orderinquick > 9 Then 'Else

orderinquick = 1

Get #1, 1, menuaccess

tbnhap.Text = Trim(menuaccess.feature)

luumuc = menuaccess.thutu

Close #1

Exit Sub

End If

Close #1

End If

'menu Quick Access

If tbnhap.Text = "Find by Name" Then

quickaccess = False

tbnhap.Text = "Find by Location"

st = "Find Location?"

luumuc = 2

Exit Sub

End If

If tbnhap.Text = "Find by Location" Then

tbnhap.Text = "Add Entry to Phone"

st = "Add to Phone?"

luumuc = 3

Exit Sub

End If

If tbnhap.Text = "Add Entry to Phone" Then

tbnhap.Text = "Add Entry to SIM"

st = "Add to SIM?"

luumuc = 4

Exit Sub

End If

If tbnhap.Text = "Add Entry to SIM" Then

tbnhap.Text = "Call VoiceMail"

st = "Call Voicemail?"

luumuc = 12

Exit Sub

End If

If tbnhap.Text = "Call VoiceMail" Then

tbnhap.Text = "Battery Meter"

st = "Battery Meter?"

luumuc = 11

Exit Sub

End If

If tbnhap.Text = "Battery Meter" Then

tbnhap.Text = "Phone Lock Now"

st = "Lock Now?"

luumuc = 5

Exit Sub

End If

If tbnhap.Text = "Phone Lock Now" Then

tbnhap.Text = "Ring Volume"

st = "Adjust Ring?"

luumuc = 6

Exit Sub

End If

If tbnhap.Text = "Ring Volume" Then

tbnhap.Text = "VibraCall On or Off"

st = "Vibrate On/Off?"

luumuc = 9

Exit Sub

End If

If tbnhap.Text = "VibraCall On or Off" Then

tbnhap.Text = " Outgoing Messages"

st = "Outgoing SMS?"

luumuc = 14

Exit Sub

End If

If tbnhap.Text = " Outgoing Messages" Then

tbnhap.Text = " Message Editor"

st = "Message Editor?"

luumuc = 15

Exit Sub

End If

If tbnhap.Text = " Message Editor" Then

tbnhap.Text = "Switch Line 1/2"

st = "Switch Line 1/2?"

luumuc = 7

Exit Sub

End If

If tbnhap.Text = "Switch Line 1/2" Then

tbnhap.Text = "Change Band"

st = "Change Band?"

luumuc = 10

Exit Sub

End If

If tbnhap.Text = "Change Band" Then

tbnhap.Text = " Show Time and Date"

st = "Show Time/Date?"

luumuc = 8

Exit Sub

End If

If tbnhap.Text = " Show Time and Date" Then

tbnhap.Text = "Find by Name"

st = "Find Name?"

luumuc = 1

Exit Sub

End If

'xu ly khi bam phim menu de di chuyen giua nhung entry

If found = True Then

Call menu_downswitchentry

End If

'khi dung phim menu de di chuyen giua nhung muc trong Fixed Dial

If listdial = True Then

Call menu_downlistdial

End If

'xu ly khi dung phim menu de di chuyen giua cac mang

If availablenetwork = True Or addnetwork = True Then

tam1 = tam1 + 1

Open filename5 For Random As #1 Len = Len(networks)

banghi = LOF(1) Len(networks)

If tam1 <= banghi Then

Get #1, tam1, networks

tbnhap.Text = networks.mang

st = networks.mang

Close #1

Else

tam1 = 1

Get #1, 1, networks

tbnhap.Text = networks.mang

st = networks.mang

Close #1

End If

Exit Sub

End If

'khi dung phim menu de di chuyen trong danh sach preferred network

If showlist = True Then

Open filename6 For Random As #1 Len = Len(networks)

banghi = LOF(1) Len(networks)

tam1 = tam1 + 1

If tam1 <= banghi Then

Get #1, tam1, networks

tbnhap.Text = networks.mang

st = networks.mang

Else

tam1 = 1

Get #1, 1, networks

tbnhap.Text = networks.mang

st = networks.mang

End If

Close #1

Exit Sub

End If

'************ Day la phim OK *************

Case 13

'***** Personal Number *********

If tbnhap.Text = "Phone Book" Then

tbnhap.Text = "Personal Number"

phonebook = True

Exit Sub

End If

'*****Find Entry by Name******

If tbnhap.Text = "Personal Number" Then

tbnhap.Text = "Find Entry by Name"

Exit Sub

End If

If tbnhap.Text = "Find Entry by Name" Or tbnhap.Text = " Find Entry by Name" Or (luumuc = 1 And quickaccess = True) Then 'longpress = False) Then

If tbnhap.Text = " Find Entry by Name" Then

send = True 'phonebook = False

End If

quickaccess = False

tbnhap.Text = "Name" & vbCrLf

cancle = False

danhso = False

changecase = True

luumuc = 0

phonebook = False

Exit Sub

End If

'***** Tim theo ten ********

If Left(tbnhap.Text, 4) = "Name" Then

k = InStr(tbnhap.Text, vbLf)

st = Mid(tbnhap.Text, k + 1)

Call find_name(st)

If send = True Then 'phonebook = False Then

sending = True

send = False

End If

cancle = True

danhso = False

changecase = False

Exit Sub

End If

'*******Tim theo vi tri *******

If tbnhap.Text = "Find Entry by Location" Or tbnhap.Text = " Find Entry by Location" Or (luumuc = 2 And quickaccess = True) Then 'longpress = False) Then

If tbnhap.Text = " Find Entry by Location" Then

send = True 'phonebook = False

End If

quickaccess = False

tbnhap.Text = " Enter Location" & vbCrLf

cancle = True 'False

danhso = True 'False

luumuc = 0

phonebook = False

Exit Sub

End If

If Left(tbnhap.Text, Len(" Enter Location")) = " Enter Location" Then

k = InStr(tbnhap.Text, vbLf)

If Mid(tbnhap.Text, k + 1) = "" Then

lo = 0

Else

lo = Val(Mid(tbnhap.Text, k + 1))

If lo < 1 Or lo > 255 Then

tbnhap.Text = " Range 1-255"

danhso = False

Exit Sub

End If

End If

Call find_location(lo)

If send = True Then 'phonebook = False Then

sending = True

send = False

End If

cancle = True

danhso = False

Exit Sub

End If

'********* vao menu con cua Find ********

If (flag = True Or menucon = True) Then 'And phonebook = True Then

k = InStr(tbnhap.Text, vbLf)

st = Trim(Mid(tbnhap.Text, k + 1))

flag = False

menucon = False

found = False

tbnhap.Text = "Call Number"

cancle = True

danhso = False

phonebook = True 'False

Exit Sub

End If

'******** Xu ly cua muc Call Number **************

If tbnhap.Text = "Call Number" Or tbnhap.Text = " Call Number" Or tbnhap.Text = "Call Number?" Then

If callbarring = True Then

tbnhap.Text = " Restricted"

Exit Sub

End If

If setupfixed = True Then

Open filefixed For Random As #1 Len = Len(news)

banghi = LOF(1) Len(news)

For j = 1 To banghi

Get #1, j, news

chuoitam = Trim(news.number)

If Trim(Mid(st, 1, Len(chuoitam))) = chuoitam Then

timthay = True

Exit For

End If

Next j

Close #1

If timthay = True Then

Image2.Visible = True

tbnhap.Text = "Calling"

danhso = False

cancle = True

Timer1.Interval = 3000

callnumber = False

phonebook = False

timthay = False

Else

tbnhap.Text = " Restricted"

Exit Sub

End If

Else

Image2.Visible = True

tbnhap.Text = "Calling"

danhso = False

cancle = True

Timer1.Interval = 3000

callnumber = False

phonebook = False

End If

End If

If tbnhap.Text = "End Call?" Then

tbnhap.Text = "Menu"

danhso = True

Image2.Visible = False

Exit Sub

End If

If tbnhap.Text = " Restricted" Then

tbnhap.Text = "Phone Book"

Exit Sub

End If

'******** Xu ly cua muc Modify Name ************

If tbnhap.Text = "Modify Name or Number" Then

phonebook = False

tbnhap.Text = "Change Name" & vbCrLf

'longpress = True

cancle = False

danhso = False

changecase = True

found = False

flag = False

menucon = False

Close #1

Exit Sub

End If

If Left(tbnhap.Text, 11) = "Change Name" Then

k = InStr(tbnhap.Text, vbLf)

st = Trim(Mid(tbnhap.Text, k + 1))

tbnhap.Text = "Number Change" & vbCrLf

cancle = True 'False

danhso = True 'False

changecase = False

Exit Sub

End If

If Left(tbnhap.Text, Len("Number Change")) = "Number Change" Then

k = InStr(tbnhap.Text, vbLf)

nu = Mid(tbnhap.Text, k + 1)

If editentrylist = True Then

Call modify(st, nu, vitri)

Else

If prevent = 2 Or prevent = 3 Then

Open filename For Random As #1 Len = Len(news)

banghi = LOF(1) Len(news)

For j = 1 To banghi

Get #1, j, news

If st1 = news.name Then

vitri = j

Exit For

End If

Next j

Close #1

End If

Call modify(st, nu, vitri)

Call sapthutu

Call prevent_access(prevent)

End If

tbnhap.Text = "Completed"

Exit Sub

End If

'******* Xu ly cua phan Erase Name *************

If tbnhap.Text = "Erase Name and Number" Then

phonebook = False

found = False

flag = False

menucon = False

Call erased(vitri)

Call prevent_access(prevent)

End If

'******* Add Entry *********

If tbnhap.Text = "Add Entry" Then

flag = False

found = False

menucon = False

tbnhap.Text = "Add To Phone Memory"

Exit Sub

End If

If tbnhap.Text = "Add To Phone Memory" Or (luumuc = 3 And quickaccess = True) Then 'longpress = False) Then

quickaccess = False

luumuc = 0

phonebook = False

tbnhap.Text = "Enter Name?" & vbCrLf

swit = True

cancle = False

danhso = False

changecase = True

Exit Sub

End If

If tbnhap.Text = "Add To SIM Card Memory" Or (luumuc = 4 And quickaccess = True) Then 'longpress = False) Then

quickaccess = False

luumuc = 0

phonebook = False

tbnhap.Text = "Enter Name?" & vbCrLf

swit = False

cancle = False

danhso = False

changecase = True

Exit Sub

End If

'******* Them vao bo nho may **********

If Left(Trim(tbnhap.Text), 11) = "Enter Name?" Then

k = InStr(tbnhap.Text, vbLf)

st = Mid(tbnhap.Text, k + 1)

If st = "" Then

Beep

tbnhap.Text = "Enter Name?" & vbCrLf

Else

tbnhap.Text = "Enter Number" & vbCrLf

cancle = True

danhso = True

changecase = False

Exit Sub

End If

End If

If Left(tbnhap.Text, Len("Enter Number")) = "Enter Number" Then

k = InStr(tbnhap.Text, vbLf)

nu = Mid(tbnhap.Text, k + 1)

If nu = "" Then

Beep

tbnhap.Text = "Enter Number" & vbCrLf

Else

menucon = False

flag = False

found = False

tbnhap.Text = "Enter Location!" & vbCrLf

danhso = True

Exit Sub

End If

End If

If Left(tbnhap.Text, 15) = "Enter Location!" Then

k = InStr(tbnhap.Text, vbLf)

ch = Mid(tbnhap.Text, k + 1) 'flag = False

If ch = "" Then

lo = add_lo(swit)

If addentrylist = True Then

Call add_entry(st, nu, lo, swit)

Else

Call add_entry(st, nu, lo, swit)

Call sapthutu

Call prevent_access(prevent)

End If

Exit Sub

Else

lo = Val(ch)

If addentrylist = True Then

If lo = 0 Or lo > 40 Then

tbnhap.Text = "Range 1-40"

danhso = False

Exit Sub

End If

'ghi vao trong Fixed Dial List

Call add_entry(st, nu, lo, swit)

Else

If swit = False Then

'ghi vao trong SIM

If lo < 100 Or lo > 255 Then

tbnhap.Text = "Range 101-255"

danhso = False

Exit Sub

End If

Call add_entry(st, nu, lo, swit)

Call sapthutu

Call prevent_access(prevent)

Exit Sub

Else

'ghi vao trong bo nho

If lo = 0 Or lo > 100 Then

tbnhap.Text = "Range 1-100"

danhso = False

Exit Sub

End If

Call add_entry(st, nu, lo, swit)

Call sapthutu

Call prevent_access(prevent)

Exit Sub

End If

End If

End If

End If

If tbnhap.Text = "Overwritten?" Then

Call OVERWRITE(st, nu, lo)

Call sapthutu

Call prevent_access(prevent)

Exit Sub

End If

'***** Kiem tra suc chua cua phone****

If tbnhap.Text = "Check Capacity" Then

tbnhap.Text = "Check Phone Capacity"

Exit Sub

End If

If tbnhap.Text = "Check Phone Capacity" Then

Call check(0)

Exit Sub

End If

If tbnhap.Text = "Check SIM Capacity" Then

Call check(1)

Exit Sub

End If

'Xu ly cua phan Prevent Access

If tbnhap.Text = "Prevent Access" Then

tbnhap.Text = "No Memory Restrictions"

Exit Sub

End If

If tbnhap.Text = "No Memory Restrictions" Then

phonebook = False

prevent = 1

tbnhap.Text = "Enter Security Code" & vbCrLf

danhso = True

Exit Sub

End If

If tbnhap.Text = "To SIM Card Memory" Then

phonebook = False

'tam = 2

prevent = 2

tbnhap.Text = "Enter Security Code" & vbCrLf

danhso = True

Exit Sub

End If

If tbnhap.Text = "To Phone Memory" Then

phonebook = False

'tam = 3

prevent = 3

tbnhap.Text = "Enter Security Code" & vbCrLf

danhso = True

Exit Sub

End If

If tbnhap.Text = "To Phone & SIM Memory" Then

phonebook = False

'tam = 4

prevent = 4

tbnhap.Text = "Enter Security Code" & vbCrLf

danhso = True

Exit Sub

End If

If Left(tbnhap.Text, 19) = "Enter Security Code" Then

k = InStr(tbn

0