全国县及县以上行政区划代码信息类

王朝other·作者佚名  2006-11-24
窄屏简体版  字體: |||超大  

身份证的前6位就是表示开出身份证所在地的区划代码。

图:

类:

Public Class RegionalclassClass Regionalclass

Private _Regionals As RegionalCollection

Private File As String = System.AppDomain.CurrentDomain.BaseDirectory & "\全国行政区划代码.txt"

Private IsOK As Boolean = False

Public ReadOnly Property ItemsCollection()Property ItemsCollection() As RegionalCollection

Get

Return _Regionals

End Get

End Property

Public Sub Load()Sub Load()

IsOK = System.IO.File.Exists(File)

If Not IsOK Then

MsgBox("文件不存在!")

Exit Sub

End If

_Regionals = New RegionalCollection

Dim fs As IO.FileStream = New IO.FileStream(File, IO.FileMode.Open)

Dim sr As IO.StreamReader = New IO.StreamReader(fs, System.Text.Encoding.Default)

Dim Line As String

Dim tmp As Regional

Dim tmp1 As Regional

Dim tmp2 As Regional

While sr.Peek <> -1

Line = sr.ReadLine

If Line.Length > 6 Then

If Char.IsNumber(Line, 0) AndAlso Char.IsNumber(Line, 5) Then

tmp = New Regional(Line.Substring(0, 6), Line.Substring(6).Trim)

If tmp.Code.Substring(4) = "00" Then '第五、第六位是0

If tmp.Code.Substring(2, 2) = "00" Then '第三、四位是0

'代表省

tmp.FullName = tmp.Name

Else

'其中01-20、51-70表示省直辖市,21-50表示地区(州、盟)

tmp1 = _Regionals.Item(tmp.Code.Substring(0, 2) & "0000")

If Not tmp1 Is Nothing Then

tmp.FullName = tmp1.Name & tmp.Name

End If

End If

Else

'01-18表示市辖区或地辖区,21-80表示县(旗),81-99表示省直辖县级市

tmp1 = _Regionals.Item(tmp.Code.Substring(0, 2) & "0000")

If Not tmp1 Is Nothing Then

If tmp1.Name.Substring(tmp1.Name.Length - 1).Equals("市") Then

tmp.FullName = tmp1.FullName & tmp.Name

Else

tmp2 = _Regionals.Item(tmp.Code.Substring(0, 4) & "00")

If Not tmp2 Is Nothing Then

tmp.FullName = tmp2.FullName & tmp.Name

End If

End If

End If

End If

_Regionals.Add(tmp)

End If

End If

End While

sr.Close()

fs.Close()

End Sub

Public Class RegionalCollectionClass RegionalCollection

Inherits System.Collections.DictionaryBase

Public Sub Add()Sub Add(ByVal iItem As Regional)

&

[1] [2] [3] [4] [5] [6] 下一页

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航