作成日: 2017/08/30 最終更新日: 2021/05/14
文書種別
使用方法
詳細
注意事項「JPAddress 辞書更新サービス」は、辞書ファイルの提供、および新規/継続のご利用お申込みを終了させていただきます。詳細は「JPAddress 辞書更新サービスの終了について」の案内をご確認ください。
辞書ファイルの更新については、上記案内の代替手段の利用をご検討くださいますようお願いいたします。
自動更新で発生したエラーは、自動更新を行う Update メソッドおよび UpdateAsync メソッドからは取得できません。
UpdateComplete イベントで取得したイベントデータの Error プロパティからエラー情報を取得します。
自動更新がエラーなく正常に完了した場合、Error プロパティは null 参照(Visual Basic では Nothing)を返します。
下記のコードでは、ボタン押下で自動更新を行った場合のエラー取得の例を紹介しています。
[Visual Basic]
Imports GrapeCity.Win.JPAddress
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler GcJPAddress1.UpdateCompleted, AddressOf GcJPAddress1_UpdateCompleted
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' 辞書ファイルを更新します。
GcJPAddress1.Update("authentication code")
' 非同期的で更新を行う場合です
' GcJPAddress1.UpdateAsync("authentication code")
End Sub
Private Sub GcJPAddress1_UpdateCompleted(ByVal sender As System.Object, ByVal e As UpdateCompletedEventArgs)
If (e.Error Is Nothing) Then
' 更新が成功した場合は、e.ErrorはNothingを返します。
MessageBox.Show("更新成功")
Else
MessageBox.Show(e.Error.Message)
End If
End Sub
[C#]
using GrapeCity.Win.JPAddress;
private void Form1_Load(object sender, EventArgs e)
{
gcJPAddress1.UpdateCompleted += new EventHandler(gcJPAddress1_UpdateCompleted);
}
private void button1_Click(object sender, EventArgs e)
{
// 辞書ファイルを更新します。
gcJPAddress1.Update("authentication code");
// 非同期的に更新を行う場合です。
// gcJPAddress1.UpdateAsync("authentication code");
}
private void gcJPAddress1_UpdateCompleted(object sender, UpdateCompletedEventArgs e)
{
if (e.Error == null)
{
// 更新が成功した場合は、e.Errorはnullを返します。
MessageBox.Show("更新成功");
}
else
{
MessageBox.Show(e.Error.Message);
}
}
旧文書番号
41275