View Full Version : Erro System.MissingMethodException


Flávio
07-27-2006, 02:15 PM
Estou com uma aplicação simples no pocket é um form com um botão e um grid.
O evento click do botão faz a carga do grid.

Nesse momento aparece o erro:
An unhandled exception of type 'System.MissingMethodException'
occurred in System.Windows.Forms.dll

E o erro fica sinalizado em
Public Class Form2

Coloco um breakpoint no evento click do botão só que ele não chega nem a
executar o evento, é como se ele tentasse carregar o form novamente.

Estou usando o VS2003, tenho instalado
compact framework 1.0 SP3, compact framework 1.0 SP3 developer, estou usando
emulador do pocket pc 2003.

Segue o código:
Public Class Form2
Inherits System.Windows.Forms.Form
Friend WithEvents PcaDataGrid1 As
PCA.MobileFramework.Windows.Forms.PCADataGrid
Friend WithEvents Button1 As System.Windows.Forms.Button

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.PcaDataGrid1 = New PCA.MobileFramework.Windows.Forms.PCADataGrid
Me.TextBox1 = New System.Windows.Forms.TextBox
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(142, 24)
Me.Button1.Text = "Button1"
'
'PcaDataGrid1
'
Me.PcaDataGrid1.Location = New System.Drawing.Point(18, 62)
Me.PcaDataGrid1.RowAltItemBackColor =
System.Drawing.SystemColors.Window
Me.PcaDataGrid1.RowItemBackColor = System.Drawing.SystemColors.Window
Me.PcaDataGrid1.Size = New System.Drawing.Size(200, 134)
Me.PcaDataGrid1.Text = "PcaDataGrid1"
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(32, 26)
Me.TextBox1.Text = ""
'
'Form2
'
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.PcaDataGrid1)
Me.Controls.Add(Me.Button1)
Me.Text = "Form2"

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim table As New DataTable("Grid")

Try
table.Columns.AddRange(New DataColumn() _
{New DataColumn("Ficha Vigilância", GetType(String)), _
New DataColumn("Paciente", GetType(String)), _
New DataColumn("Idade", GetType(String)), _
New DataColumn("Quarto", GetType(String)), _
New DataColumn("Leito", GetType(String)), _
New DataColumn("Passagem", GetType(String)), _
New DataColumn("Prontuário", GetType(String)), _
New DataColumn("Dt Internação", GetType(String))})

'adding rows
table.Rows.Add(New Object() {"1", "Paciente 1", "26", "22", "4",
"100001", "9000", "17/7/2006"})
table.Rows.Add(New Object() {"2", "Paciente 2", "23", "22", "5",
"111111", "2122", "17/6/2006"})

PcaDataGrid1.DataSource = table

Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OKOnly, "Aviso")
End Try
End Sub
End Class

Vocês já se depararam com esse erro?

Abraço,

--
Flávio
Analista Desenvolvedor