try { } catch (Exception ex) { if (ex is COMException) { COMException exCOM = (COMException)ex; MessageBox.Show(exCOM.Message, "エラー(" + exCOM.ErrorCode.ToString() +eBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(ex.Message, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
Try Catch ex As Exception If (TypeOf ex Is System.Runtime.InteropServices.COMException) Then Dim exCOM As System.Runtime.InteropServices.COMException = CType(ex, Sysime.InteropServices.COMException) MessageBox.Show(exCOM.ErrorCode.ToString() + Environment.NewLine + exCOM, "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error) Else MessageBox.Show(ex.Message) End If End Try 'エラーコード http://resources.arcgis.com/en/help/arcobjects-net/conceptualhelp/#/ArcObjects_error_codes/0001000002zz000000/