// 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