View: 4255|Reply: 7
|
code snippets, visual basic 2010
[Copy link]
|
|
Post Last Edit by sepulnuar at 14-9-2010 00:43
tujuan : memastikan input yang dimasukkan ke dalam TextBox adalah nombor telefon rumah/bimbit di malaysia.
senarai komponen :
1. TextBox, untuk input nombor telefon.
method :-
- 'memastikan kekunci yang ditekan oleh user adalah nombor sahaja
- Public Sub number(ByRef keyedIn As KeyPressEventArgs)
- If keyedIn.KeyChar <> Chr(8) Then 'kekunci selain "backspace"
- If keyedIn.KeyChar < Chr(48) Or keyedIn.KeyChar > Chr(57) Then 'kekunci selain "0-9"
- keyedIn.KeyChar = Chr(0) 'tukar kekunci menjadi "null"
- Beep() 'kasi keluar bunyi sikit (ikut selera masing-masing)
- End If
- End If
- End Sub
- 'memastikan nombor yang dimasukkan adalah nombor telefon rumah/bimbit.
- Public Sub phone(ByRef key As KeyPressEventArgs, ByRef textBoxName As TextBox)
- 'letakkan kursor pada indeks terakhir
- textBoxName.Select(textBoxName.TextLength, 0)
- number(key)
- Select Case textBoxName.TextLength 'kira berapa panjang input yang telah dimasukkan
- Case 0
- If key.KeyChar <> Chr(48) Then 'pastikan nombor pertama adalah "0"
- key.KeyChar = Chr(0)
- Beep()
- End If
- Case 1
- If key.KeyChar < Chr(49) And key.KeyChar <> Chr(8) Then 'pastikan nombor ke-2 bukan "0"
- key.KeyChar = Chr(0)
- Beep()
- End If
- Case 2
- 'jika nombor kedua adalah "3" atau "1" jadikan panjang maksimum textbox = 11,
- 'selain itu jadikan panjang maksimum textbox = 10
- If textBoxName.Text.Substring(1) = 3 Or textBoxName.Text.Substring(1) = 1 Then
- textBoxName.MaxLength = 11
- Else
- textBoxName.MaxLength = 10
- End If
- 'jika nombor ke-2 bukan "1" atau "8", tambahkan "-" pada indeks ke-3
- If textBoxName.Text.Substring(1) <> 8 And textBoxName.Text.Substring(1) <> 1 And key.KeyChar <> Chr(8) Then
- textBoxName.Text &= "-"
- textBoxName.Select(3, 0) 'letakkan kursor pada indeks terakhir(indeks ke-4) untuk input ke-3
- End If
- Case 3
- 'jika nombor ke-2 adalah "1" atau "8", tambahkan "-" pada indeks ke-4
- If (textBoxName.Text.Substring(1, 1) = 8 Or textBoxName.Text.Substring(1, 1) = 1) And key.KeyChar <> Chr(8) Then
- textBoxName.Text &= "-"
- textBoxName.Select(4, 0) 'letakkan kursor pada indeks terakhir(indeks ke-5) untuk input ke-4
- End If
- End Select
- End Sub
Copy the Code
snippet :-
- <?xml version="1.0" encoding="utf-8"?>
- <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title />
- <Author />
- <Description />
- <HelpUrl />
- <SnippetTypes />
- <Keywords />
- <Shortcut />
- </Header>
- <Snippet>
- <References />
- <Imports />
- <Declarations>
- <Literal Editable="true">
- <ID>txtPhone</ID>
- <Type />
- <ToolTip />
- <Default>txtPhone</Default>
- <Function />
- </Literal>
- </Declarations>
- <Code Language="VB" Kind="" Delimiter="$"><![CDATA[Private Sub $txtPhone$_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles $txtPhone$.KeyPress
- phone(e, $txtPhone$)
- End Sub]]></Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Copy the Code
rujukan :-
senarai Chr() :
http://msdn.microsoft.com/en-us/library/60ecse8t(v=VS.80).aspx
http://msdn.microsoft.com/en-us/library/9hxt0028(v=VS.80).aspx
maklumat nombor telefon di malaysia :
http://en.wikipedia.org/wiki/Telephone_numbers_in_Malaysia |
|
|
|
|
|
|
|
Post Last Edit by sepulnuar at 9-9-2010 19:05
tujuan : masukkan senarai daerah ke dalam combobox berdasarkan negeri yang dipilih dalam malaysia.
senarai komponen:
1. ComboBox, untuk negeri. masukkan item-item negeri dalam malaysia ke dalam ComboBox negeri
{"Johor","Kedah","Kelantan","Melaka","Negeri Sembilan","Pahang","Perak","Perlis","Pulau Pinang","Sabah","Sarawak","Selangor",Terengganu","WP Kuala Lumpur","WP Labuan","WP Putrajaya"}
2. ComboBox, untuk daerah.
method :-
- Public Sub listCity(ByVal state As String, ByRef comboBoxName As ComboBox)
- comboBoxName .Items.Clear() 'kasi bersih combobox daerah dulu
- Select Case state
- Case "Johor"
- comboBoxName .Items.AddRange(New Object() _
- {"Ayer Baloi", "Ayer Hitam", "Ayer Tawar", "Bandar Penawar", "Bandar Tenggara",
- "Batu Anam", "Batu Pahat", "Bekok", "Benut", "Bukit Gambir", "Bukit Pasir",
- "Chaah", "Endau", "Gelang Patah", "Gerisek", "Gugusan Taib Andak", "Jementah",
- "Johor Bahru", "Kahang", "Kluang", "Kota Tinggi", "Kukup", "Kulai", "Labis",
- "Layang-Layang", "Masai", "Mersing", "Muar", "Nusajaya", "Pagoh", "Paloh",
- "Panchor", "Parit Jawa", "Parit Raja", "Parit Sulong", "Pasir Gudang",
- "Pekan Nenas", "Pengerang", "Pontian", "Renggam", "Rengit", "Segamat",
- "Semerah", "Senai", "Senggarang", "Seri Gading", "Seri Medan",
- "Simpang Renggam", "Sungai Mati", "Tangkak", "Ulu Tiram", "Yong Peng"})
- Case "Kedah"
- comboBoxName .Items.AddRange(New Object() _
- {"Alor Setar", "Baling", "Bandar Baharu", "Bedong", "Bukit Kayu Hitam", "Changloon",
- "Gurun", "Jeniang", "Jitra", "Karangan", "Kepala Batas", "Kodiang", "Kota Kuala Muda",
- "Kota Sarang Semut", "Kuala Kedah", "Kuala Ketil", "Kuala Nerang", "Kuala Pegang", "Kulim",
- "Kupang", "Langgar", "Langkawi", "Lunas", "Merbok", "Padang Serai", "Pendang", "Pokok Sena",
- "Serdang", "Sik", "Simpang Empat", "Sungai Petani", "Universiti Utara Malaysia", "Yan"})
- Case "Kelantan"
- comboBoxName .Items.AddRange(New Object() _
- {"Ayer Lanas", "Bachok", "Cherang Ruku", "Dabong", "Gua Musang", "Jeli", "Kem Desa Pahlawan",
- "Ketereh", "Kota Bharu", "Kuala Balah", "Kuala Krai", "Machang", "Melor", "Pasir Mas",
- "Pasir Puteh", "Pulai Condong", "Rantau Panjang", "Selising", "Tanah Merah", "Temangan",
- "Tumpat", "Wakaf Bharu"})
- Case "Melaka"
- comboBoxName .Items.AddRange(New Object() _
- {"Alor Gajah", "Asahan", "Ayer Keroh", "Bemban", "Durian Tunggal", "Jasin",
- "Masjid Tanah", "Melaka", "Merlimau", "Selandar", "Sungai Rambai", "Tanjong Kling"})
- Case "Negeri Sembilan"
- comboBoxName .Items.AddRange(New Object() _
- {"Bahau", "Bandar Baru Enstek", "Bandar Seri Jempol", "Batu Kikir", "Gemas", "Gemencheh",
- "Johol", "Kota", "Kuala Klawang", "Kuala Pilah", "Labu", "Linggi", "Mantin", "Nilai",
- "Port Dickson", "Pusat Bandar Palong", "Rantau", "Rembau", "Rompin", "Seremban",
- "Si Rusa", "Simpang Durian", "Simpang Pertang", "Tampin", "Tanjong Ipoh"})
- Case "Pahang"
- comboBoxName .Items.AddRange(New Object() _
- {"Balok", "Bandar Bera", "Bandar Pusat Jengka", "Bandar Tun Abdul Razak", "Benta",
- "Bentong", "Brinchang", "Bukit Fraser", "Bukit Goh", "Chenor", "Chini", "Damak",
- "Dong", "Gambang", "Jerantut", "Karak", "Kemayan", "Kuala Krau", "Kuala Lipis",
- "Kuala Rompin", "Kuantan", "Lanchang", "Lurah Bilut", "Maran", "Mentakab",
- "Muadzam Shah", "Padang Tengku", "Pekan", "Raub", "Ringlet", "Sega", "Sungai Koyan",
- "Sungai Lembing", "Sungai Ruan", "Tanah Rata", "Temerloh", "Triang"})
- Case "Perak"
- comboBoxName .Items.AddRange(New Object() _
- {"Ayer Tawar", "Bagan Datoh", "Bagan Serai", "Bandar Baharu", "Batu Gajah", "Batu Kurau",
- "Behrang Stesen", "Bidor", "Bota", "Brinchang", "Bruas", "Changkat Jering", "Changkat Keruing",
- "Chemor", "Chenderiang", "Chenderong Balai", "Chikus", "Enggor", "Gerik", "Gopeng",
- "Hutan Melingtang", "Ipoh", "Jeram", "Kampar", "Kampong Gajah", "Kampong Kepayang",
- "Kamunting", "Kuala Kangsar", "Kuala Kurau", "Kuala Sepetang", "Lambor Kanan", "Langkap",
- "Lenggong", "Lumut", "Malin Nawar", "Mambang Di Awan", "Manong", "Matang", "Padang Rengas",
- "Pangkor", "Pantai Remis", "Parit", "Parit Buntar", "Pengkalan Hulu", "Pusing", "Rantau Panjang",
- "Sauk", "Selama", "Selekoh", "Seri Manjung", "Simpang", "Simpang Ampat Semanggol", "Sitiawan",
- "Slim River", "Sungai Siput", "Sungai Sumun", "Sungkai", "Taiping", "Tanjong Malim", "Tanjong Piandang",
- "Tanjong Rambutan", "Tanjong Tualang", "Tapah", "Tapah Road", "Teluk Intan", "Temoh", "Trolak",
- "Trong", "Tronoh", "Ulu Bertam", "Ulu Kinta"})
- Case "Perlis"
- comboBoxName .Items.AddRange(New Object() _
- {"Arau", "Kaki Bukit", "Kangar", "Kuala Perlis", "Padang Besar", "Simpang Ampat"})
- Case "Pulau Pinang"
- comboBoxName .Items.AddRange(New Object() _
- {"Ayer Itam", "Balik Pulau", "Bandar Bahru", "Batu Feringgi", "Batu Maung", "Bayan Lepas",
- "Bukit Mertajam", "Butterworth", "Gelugor", "Jelutong", "Kepala Batas", "Kubang Semang",
- "Nibong Tebal", "Penaga", "Penang Hill", "Perai", "Permatang Pauh", "Pulau Pinang",
- "Simpang Ampat", "Sungai Jawi", "Tanjong Bungah", "Tanjung Bungah", "Tasek Gelugor"})
- Case "Sabah"
- comboBoxName .Items.AddRange(New Object() _
- {"Beufort", "Beluran", "Beverly", "Bongawan", "Keningau", "Kota Belud", "Kota Kinabalu",
- "Kota Kinabatangan", "Kota Marudu", "Kuala Penyu", "Kudat", "Kunak", "Lahad Datu",
- "Likas", "Membakut", "Menumbok", "Nabawan", "Pamol", "Papar", "Penampang", "Putatan",
- "Ranau", "Sandakan", "Semporna", "Sipitang", "Tambunan", "Tamparuli", "Tanjung Aru",
- "Tawau", "Tenghilan", "Tenom", "Tuaran"})
- Case "Sarawak"
- comboBoxName .Items.AddRange(New Object() _
- {"Asajaya", "Balingian", "Baram", "Bau", "Bekenu", "Belaga", "Belawai", "Betong", "Bintangor",
- "Bintulu", "Dalat", "Daro", "Debak", "Engkilili", "Julau", "Kabong", "Kanowit", "Kapit",
- "Kota Samarahan", "Kuching", "Lawas", "Limbang", "Lingga", "Long Lama", "Lubok Antu", "Lundu",
- "Lutong", "Matu", "Miri", "Mukah", "Nanga Medamint", "Niah", "Pusa", "Roban", "Saratok",
- "Sarikei", "Sebauh", "Sebuyau", "Serian", "Sibu", "Siburan", "Simunjan", "Song", "Spaoh",
- "Sri Aman", "Sundar", "Tatau"})
- Case "Selangor"
- comboBoxName .Items.AddRange(New Object() _
- {"Ampang", "Bandar Baru Bangi", "Bandar Puncak Alam", "Banting", "Batang Berjuntai", "Batang Kali",
- "Batu Arang", "Batu Caves", "Beranang", "Bukit Fraser", "Bukit Rotan", "Cheras", "Cyberjaya",
- "Dengkil", "Gombak", "Hulu Langat", "Jenjarom", "Jeram", "Kajang", "Kapar", "Kerling", "Klang",
- "Kuala Kubu Baru", "Kuala Selangor", "Pelabuhan Klang", "Petaling Jaya", "Puchong", "Pulau Carey",
- "Pulau Indah", "Rasa", "Rawang", "Sabak Bernam", "Sekinchan", "Semenyih", "Sepang", "Serendah",
- "Seri Kembangan", "Shah Alam", "Subang Jaya", "Sungai Ayer Tawar", "Sungai Besar", "Sungai Buloh",
- "Sungai Pelek", "Tanjong Karang", "Tanjong Sepat", "Telok Panglima Garang", " UKM Bangi", "UPM Serdang"})
- Case "Terengganu"
- comboBoxName .Items.AddRange(New Object() _
- {"Ajil", "Al Muktatfi Billah Shah", "Ayer Puteh", "Bukit Besi", "Bukit Payong", "Ceneh", "Chalok",
- "Cukai", "Dungun", "Jerteh", "Kampong Raja", "Kemasek", "Kerteh", "Ketengah Jaya", "Kijal",
- "Kuala Berang", "Kuala Besut", "Kuala Terengganu", "Marang", "Paka", "Permaisuri", "Sungai Tong"})
- Case "WP Kuala Lumpur"
- comboBoxName .Items.AddRange(New Object() {"Kuala Lumpur"})
- Case "WP Labuan"
- comboBoxName .Items.AddRange(New Object() {"Labuan"})
- Case "WP Putrajaya"
- comboBoxName .Items.AddRange(New Object() {"Putrajaya"})
- End Select
- End Sub
Copy the Code |
|
|
|
|
|
|
|
buat la multi dimension array. |
|
|
|
|
|
|
|
Post Last Edit by sepulnuar at 14-9-2010 00:42
Reply 3# sepulnuar
snippet :-
- <?xml version="1.0" encoding="utf-8"?>
- <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title />
- <Author />
- <Description />
- <HelpUrl />
- <SnippetTypes />
- <Keywords />
- <Shortcut />
- </Header>
- <Snippet>
- <References />
- <Imports />
- <Declarations>
- <Literal Editable="true">
- <ID>cboState</ID>
- <Type />
- <ToolTip />
- <Default>cboState</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>cboCity</ID>
- <Type />
- <ToolTip />
- <Default>cboCity</Default>
- <Function />
- </Literal>
- </Declarations>
- <Code Language="VB" Kind="" Delimiter="$"><![CDATA[Private Sub $cboState$_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles $cboState$.SelectedIndexChanged
- listCity($cboState$.Text, $cboCity$)
- End Sub]]></Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Copy the Code
maaf jika senarai daerah tidak lengkap. |
|
|
|
|
|
|
|
Post Last Edit by sepulnuar at 12-9-2010 08:32
Reply 4# alien3d
tujuan : dynamic JADUAL VIGENERE using multi-dimension array
keperluan : console application
method :-
- Function assignValue(ByRef v As Object, ByVal startChar As Char, ByVal endChar As Char) As Int16
- 'validating startChar and endChar
- If 48 <= Asc(startChar) And Asc(startChar) <= 57 Then 'value from "0" to "9"
- If Asc(endChar) < Asc(startChar) Or 57 < Asc(endChar) Then
- MsgBox("invalid endChar parameter", MsgBoxStyle.Exclamation)
- Return -1
- End If
- ElseIf 65 <= Asc(startChar) And Asc(startChar) <= 90 Then 'value from "A" to "Z"
- If Asc(endChar) < Asc(startChar) Or 90 < Asc(endChar) Then
- MsgBox("invalid endChar parameter", MsgBoxStyle.Exclamation)
- Return -1
- End If
- ElseIf 97 <= Asc(startChar) And Asc(startChar) <= 122 Then 'value from "a" to "z"
- If Asc(endChar) < Asc(startChar) Or 122 < Asc(endChar) Then
- MsgBox("invalid endChar parameter", MsgBoxStyle.Exclamation)
- Return -1
- End If
- Else
- MsgBox("invalid startChar parameter", MsgBoxStyle.Exclamation)
- Return -1
- End If
- Dim length = Asc(endChar) - Asc(startChar), startNum = Asc(startChar)
- 're-declare v to multidimension array based on endChar-startChar length
- ReDim v(length, length)
- For i = 0 To length
- For j = 0 To length
- If i + j <= length Then
- v(i, j) = Chr(i + j + startNum)
- Else
- v(i, j) = Chr(i + j + startNum - (length + 1))
- End If
- Next
- Next
- Return length
- End Function
Copy the Code
snippet :-
- <?xml version="1.0" encoding="utf-8"?>
- <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>jadualVigenere</Title>
- <Author />
- <Description />
- <HelpUrl />
- <SnippetTypes />
- <Keywords />
- <Shortcut />
- </Header>
- <Snippet>
- <References />
- <Imports />
- <Declarations>
- <Literal Editable="true">
- <ID>length</ID>
- <Type />
- <ToolTip />
- <Default>length</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>vigenere</ID>
- <Type />
- <ToolTip />
- <Default>vigenere</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>startChar</ID>
- <Type />
- <ToolTip />
- <Default>startChar</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>endChar</ID>
- <Type />
- <ToolTip />
- <Default>endChar</Default>
- <Function />
- </Literal>
- </Declarations>
- <Code Language="VB" Kind="" Delimiter="$"><![CDATA[Dim $length$= assignValue($vigenere$, "$startChar$", "$endChar$")
- Console.WriteLine("JADUAL VIGENERE")
- Console.WriteLine()
- For i = 0 To $length$ * 2 + 8
- Console.Write("-")
- Next
- Console.WriteLine()
- Console.Write("| * | ")
- For i = 0 To $length$
- Console.Write($vigenere$(i, 0) & " ")
- Next
- Console.Write("|")
- Console.WriteLine()
- For i = 0 To $length$ * 2 + 8
- Console.Write("-")
- Next
- Console.WriteLine()
- For i = 0 To $length$
- Console.Write("| " & $vigenere$(i, 0) & " | ")
- For j = 0 To $length$
- Console.Write($vigenere$(i, j) & " ")
- Next
- Console.Write("|")
- Console.WriteLine()
- Next
- For i = 0 To $length$ * 2 + 8
- Console.Write("-")
- Next]]></Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Copy the Code |
|
|
|
|
|
|
|
tujuan : dapatkan tarikh lahir, tempat lahir dan jantina daripada nombor mykad
keperluan : pastikan short date format bagi local machine = dd/MM/yyyy
method :-
- Public Sub mykad(ByVal number As Int64, ByRef dob As Date, ByRef pob() As String, ByRef sex As Boolean)
- If number < 100000000000 Then
- MsgBox("invalid number, not enough lenght", MsgBoxStyle.Exclamation)
- Exit Sub
- End If
- Dim year
- If number.ToString.Substring(0, 1) < Now.Year.ToString.Substring(2, 2) Then
- year = 20 & number.ToString.Substring(0, 2)
- Else
- year = 19 & number.ToString.Substring(0, 2)
- End If
- Dim month = number.ToString.Substring(2, 2)
- Dim day = number.ToString.Substring(4, 2)
- Try
- dob = day & "/" & month & "/" & year
- Catch
- MsgBox("invalid number, first 6-digits is wrong", MsgBoxStyle.Exclamation)
- Exit Sub
- End Try
- Select Case number.ToString.Substring(6, 2)
- Case "01", "21", "22", "23", "24"
- pob = {"Johor"}
- Case "02", "25", "26", "27"
- pob = {"Kedah"}
- Case "03", "28", "29"
- pob = {"Kelantan"}
- Case "04", "30"
- pob = {"Melaka"}
- Case "05", "31", "59"
- pob = {"Negeri Sembilan"}
- Case "06", "32", "33"
- pob = {"Pahang"}
- Case "07", "34", "35"
- pob = {"Pulau Pinang"}
- Case "08", "36", "37", "38", "39"
- pob = {"Perak"}
- Case "09", "40"
- pob = {"Perlis"}
- Case "10", "41", "42", "43", "44"
- pob = {"Selangor"}
- Case "11", "45", "46"
- pob = {"Terengganu"}
- Case "12", "47", "48", "49"
- pob = {"Sabah"}
- Case "13", "50", "51", "52", "53"
- pob = {"Sarawak"}
- Case "14", "54", "55", "56", "57"
- pob = {"WP Kuala Lumpur"}
- Case "15", "58"
- pob = {"WP Labuan"}
- Case "16"
- pob = {"WP Putrajaya"}
- Case "82"
- pob = {"Unknown State"}
- Case "60"
- pob = {"Brunei"}
- Case "61"
- pob = {"Indonesia"}
- Case "62"
- pob = {"Cambodia"}
- Case "63"
- pob = {"Laos"}
- Case "64"
- pob = {"Myanmar"}
- Case "65"
- pob = {"Philipines"}
- Case "66"
- pob = {"Singapore"}
- Case "67"
- pob = {"Thailand"}
- Case "68"
- pob = {"Vietnam"}
- Case "71"
- pob = {"United Kingdom", "Indonesia"}
- Case "74"
- pob = {"China"}
- Case "75"
- pob = {"India"}
- Case "76"
- pob = {"Pakistan"}
- Case "77"
- pob = {"Saudi Arabia"}
- Case "78"
- pob = {"Sri Lanka"}
- Case "79"
- pob = {"Bangladesh"}
- Case "83"
- pob = {"Australia", "American Samoa", "Fiji", "Macedonia", "New Caledonia", "New Zealand", "Papua New Guinea", "Timor Leste"}
- Case "84"
- pob = {"Argentina", "Anguilla", "Aruba", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "Paraguay", "Peru", "Uruguay", "Venezuella"}
- Case "85"
- pob = {"Algeria", "Angola", "Botswana", "Burundi", "Cameroon", "Chad", "Djibouti", "Egypt", "Ethiopia", "Eritria", "Gambia", "Ghana", "Kenya", "Liberia", "Malawi", "Mali", "Mauritania", "Morocco", "Mozambique", "Namibia", "Nigeria", "Rwanda", "Senegal", "Sierra Leone", "Somalia", "Sudan", "South Africa", "Swaziland", "Tanzania", "Tonga", "Tunisia", "Uganda", "Zaire", "Zambia", "Zimbabwe"}
- Case "86"
- pob = {"Austria", "Armenia", "Belgium", "Cyprus", "Czech Republic", "Denmark", "France", "Finland", "Greece", "Germany", "Italy", "Luxembourg", "Malta", "Monaco", "Netherlands", "Norway", "Portugal", "Slovakia", "Slovenia", "Spain", "Sweedan", "Switzerland", "Togo"}
- Case "87"
- pob = {"Ireland", "United Kingdom"}
- Case "88"
- pob = {"Bahrain", "Iran", "Iraq", "Israel", "Jordan", "Kuwait", "Lebanon", "Oman", "Qatar", "Syria", "Turkey", "United Arab Emirates", "Yemen"}
- Case "89"
- pob = {"Japan", "North Korea", "South Korea", "Taiwan"}
- Case "90"
- pob = {"Bahamas", "Barbados", "Belize", "Costa Rica", "Cuba", "Dominica", "El Salvador", "Grenada", "Guatemala", "Haiti", "Honduras", "Jamaica", "Mexico", "Nicaragua", "Panama", "Puerto Rico", "Trinidad and Tobago"}
- Case "91"
- pob = {"Canada", "Greenland", "United States"}
- Case "92"
- pob = {"Albania", "Bulgaria", "Belarus", "Bosnia", "Crotia", "Czechoslovakia", "Estonia", "Georgia", "Hungary", "Latvia", "Lithuania", "Poland", "Romania", "Russia", "Serbia", "Ukraine", "Yugoslavia"}
- Case "93"
- pob = {"Afghanistan", "Antigua and Barbuda", "Andorra", "Antarctica", "Azerbaijan", "Benin", "Bhutan", "Bermuda", "Burkina Faso", "Cape Verde", "Comoros", "Cote d'lvoire", "French Polynesia", "Gibraltar", "Guinea", "Hong Kong", "Kazakhstan", "Libya", "Macau", "Madagascar", "Maldives", "Mauritius", "Mongolia", "Nepal", "Palestine", "Samoa", "San Marino", "Seychelles", "Solomon Islands", "Tajikistan", "Turkmenistan", "Uzbekistan", "Vanuatu"}
- Case Else
- MsgBox("unknown birth place code", MsgBoxStyle.Exclamation)
- Exit Sub
- End Select
- If (number Mod 10) Mod 2 = 0 Then
- sex = False 'female
- Else
- sex = True 'male
- End If
- End Sub
Copy the Code
snippet :-
- <?xml version="1.0" encoding="utf-8"?>
- <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>mykad</Title>
- <Author />
- <Description />
- <HelpUrl />
- <SnippetTypes />
- <Keywords />
- <Shortcut />
- </Header>
- <Snippet>
- <References />
- <Imports />
- <Declarations>
- <Literal Editable="true">
- <ID>dateOfBirth</ID>
- <Type />
- <ToolTip />
- <Default>dateOfBirth</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>placeOfBirth</ID>
- <Type />
- <ToolTip />
- <Default>placeOfBirth</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>gender</ID>
- <Type />
- <ToolTip>true = female, false = male</ToolTip>
- <Default>gender</Default>
- <Function />
- </Literal>
- <Literal Editable="true">
- <ID>############</ID>
- <Type />
- <ToolTip />
- <Default>############</Default>
- <Function />
- </Literal>
- </Declarations>
- <Code Language="VB" Kind="" Delimiter="$"><![CDATA[Dim $dateOfBirth$As Date
- Dim $placeOfBirth$() As String
- Dim $gender$As Boolean
- mykad($############$, $dateOfBirth$, $placeOfBirth$, $gender$)]]></Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Copy the Code |
|
|
|
|
|
|
|
boleh terangkan dahulu x? apakah maksud code snippets? |
|
|
|
|
|
|
| |
|