PowerTools InputMan for Windows Forms 8.0J
SelectedPrefecture プロパティ
使用例 

選択された都道府県情報を取得します。
構文
Public ReadOnly Property SelectedPrefecture As RegionInfo
public RegionInfo SelectedPrefecture {get;}

プロパティ値

選択された都道府県。
使用例
次のコード例は都道府県を指定したGcAddressBoxコントロールの作成例です。
//  Please use the following namespace
//  using System.Windows.Forms;
//  using GrapeCity.Win.Editors;

public void CustomizeGcAddressBox()
{
    // Creates an instance of a GcAddressBox control.
    GcAddressBox gcAddressBox1 = new GcAddressBox();

    // let Prefecture/City/Town/Area/BlockCode field are separator with "-".
    gcAddressBox1.Fields.CitySeparator.Text = "-";
    gcAddressBox1.Fields.TownSeparator.Text = "-";
    gcAddressBox1.Fields.AreaSeparator.Text = "-";
    gcAddressBox1.Fields.BlockCodeSeparator.Text = "-";

    // Sets the PrefectureFilter property.
    // Only allow to operate the region which belongs to 北海道/宮城県/東京都.
    gcAddressBox1.PrefectureFilter = "北海道,宮城県,東京都";

    gcAddressBox1.ZipCodeChanged += delegate
    {
        string zipcode = gcAddressBox1.ZipCode;
        RegionInfo prefecture = gcAddressBox1.SelectedPrefecture;
        RegionInfo city = gcAddressBox1.SelectedCity;
        RegionInfo town = gcAddressBox1.SelectedTown;
        RegionInfo area = gcAddressBox1.SelectedArea;
    };
}
'  Please use the following namespace
'  Imports System.Windows.Forms
'  Imports GrapeCity.Win.Editors

' Creates an instance of a GcAddressBox control.
Dim gcAddressBox1 As New GcAddressBox()

Public Sub CustomizeGcAddressBox()

    ' let Prefecture/City/Town/Area/BlockCode field are separator with "-".
    gcAddressBox1.Fields.CitySeparator.Text = "-"
    gcAddressBox1.Fields.TownSeparator.Text = "-"
    gcAddressBox1.Fields.AreaSeparator.Text = "-"
    gcAddressBox1.Fields.BlockCodeSeparator.Text = "-"

    ' Sets the PrefectureFilter property.
    ' Only allow to operate the region which belongs to 北海道/宮城県/東京都.
    gcAddressBox1.PrefectureFilter = "北海道,宮城県,東京都"

    AddHandler gcAddressBox1.ZipCodeChanged, AddressOf OnZipCodeChanged
End Sub

Private Sub OnZipCodeChanged(ByVal sender As Object, ByVal e As EventArgs)
    Dim zipcode As String = gcAddressBox1.ZipCode
    Dim prefecture As RegionInfo = gcAddressBox1.SelectedPrefecture
    Dim city As RegionInfo = gcAddressBox1.SelectedCity
    Dim town As RegionInfo = gcAddressBox1.SelectedTown
    Dim area As RegionInfo = gcAddressBox1.SelectedArea
End Sub
参照

GcAddressBox クラス
GcAddressBox メンバ

 

 


© 2004-2015 GrapeCity inc. All rights reserved.