THE STATEMENT IS NOT VALID IN A NAMESPACE

SAMUELRIBEIRO 13/06/2013 14:40:48
#424730
Boa tarde Senhores.

Estou desde ontem tentando resolver este problema com a ajuda do colega Filman.
Mas infelizmente até agora não consegui.
Oerro que aprece agora 14 vezes é este [Ô][txt-color=#e80000]THE STATEMENT IS NOT VALID IN A NAMESPACE[/txt-color][Ô]

O código que esta incompleto ainda é este.:

Citação:

Imports MySql.Data.MySqlClient
Imports System.IO
Imports System.Int32
Imports System.DateTime

Public Class frmLogin

Inherits System.Windows.Forms.Form

Dim conn As New MySqlConnection
Dim myCommand As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter
Dim myData As New DataTable
Dim SQL As String

Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim conn As MySqlConnection
conn = New MySqlConnection
Dim lblHora As DateTime = Now
Dim lblData As Date

conn.ConnectionString = [Ô]server=localhost;user id=Administrado;password=25041966;database=siscom[Ô]

SQL = [Ô]SELECT * FROM siscom.usuario[Ô]

lblHora.Text = Date.Now.ToString([Ô]hh:mm:ss[Ô])
lblData.Date = Date.Now.ToString([Ô]dd/MM/yyyy[Ô])

Try
conn.Open()
Try
myCommand.Connection = conn
myCommand.CommandText = SQL
myAdapter.SelectCommand = myCommand
myAdapter.Fill(myData)
[ô]DataGrid.DataSource = myData
Catch myerro As MySqlException
MsgBox([Ô]Erro de leitura no banco de dados : [Ô] & myerro.Message)
End Try
MessageBox.Show([Ô]Conexão aberta com sucesso[Ô])
conn.Close()
Catch myerro As MySqlException
MessageBox.Show([Ô]Erro ao conectar com o Banco de dados : [Ô] & myerro.Message)
Finally
conn.Dispose()
End Try
End Sub
End Class

[txt-color=#e80000] [/txt-color]

Alguém sabe como resolver este erro e o designer do formulário login aparecer denovo

Desde já agraadeço
OMAR2011 13/06/2013 15:05:58
#424732
Cabra,não deu erro nenhum.
Você tem que fazer a referência do Mysql.
Se não fizer, sempre vai da erro.
SAMUELRIBEIRO 13/06/2013 15:10:06
#424733
Boa tarde Omar2011

Muito Obrigado pela atenção.

Sou leigo nesta parte.
Como faço isto.?
OMAR2011 13/06/2013 16:00:21
#424735
Vá no youtube e digite
conexão vb2010 mysql
Vai aparecer os video com como faz a referência.
SAMUELRIBEIRO 13/06/2013 16:33:49
#424737
Omar2011 Tudo o que diz nos videos que eu assisti eu ja fiz e o erro continua.
OMAR2011 13/06/2013 17:47:47
#424744
Vou mostrar como faz.
Click em Project
Click em Add reference
Vai abrir uma Tela
Clica em Browse
Vá até onde esta instalado o seu
MySQL Connector Net 6.3.6 ou o que tiver
Este é o meu.
C:\Program Files\MySQL\MySQL Connector Net 6.3.6\Assemblies\v2.0
este é o meu caminho e selecone MySql.Data.
E clica em ok
Faça isso.
SAMUELRIBEIRO 13/06/2013 17:53:32
#424745
então, é isto que estou te Dizendo. Veja o anexo que estou te enviando.
OMAR2011 13/06/2013 19:26:27
#424754
Adicione seu projeto onde está dando
erro.
Vou verificar ou outro do fórum.

SAMUELRIBEIRO 14/06/2013 09:11:39
#424763
Bom dia Omar2011.

Segue abaixo o código onde esta de vermelho é onde esta dando o erro.

Citação:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
<Global.System.Diagnostics.CodeAnalysis.SuppressMessage([Ô]Microsoft.Naming[Ô], [Ô]CA1726[Ô])> _
Partial Class frmLogin

End Class

[txt-color=#e80000]<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
[/txt-color]
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try

Friend WithEvents LogoPictureBox As System.Windows.Forms.PictureBox
Friend WithEvents UsernameLabel As System.Windows.Forms.Label
Friend WithEvents PasswordLabel As System.Windows.Forms.Label
Friend WithEvents txtUsuario As System.Windows.Forms.TextBox
Friend WithEvents txtSenha As System.Windows.Forms.TextBox
Friend WithEvents OK As System.Windows.Forms.Button
Friend WithEvents Cancel As System.Windows.Forms.Button

End Sub

[txt-color=#e80000]Private components As System.ComponentModel.IContainer[/txt-color]


[txt-color=#e80000]<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()[/txt-color]

Me.UsernameLabel = New System.Windows.Forms.Label
Me.PasswordLabel = New System.Windows.Forms.Label
Me.txtUsuario = New System.Windows.Forms.TextBox
Me.txtSenha = New System.Windows.Forms.TextBox
Me.OK = New System.Windows.Forms.Button
Me.Cancel = New System.Windows.Forms.Button
Me.LogoPictureBox = New System.Windows.Forms.PictureBox
Me.lblData = New System.Windows.Forms.Label
Me.lblHora = New System.Windows.Forms.Label
Me.lblAviso = New System.Windows.Forms.Label
CType(Me.LogoPictureBox, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
[ô]
[ô]UsernameLabel
[ô]
Me.UsernameLabel.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 9.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.UsernameLabel.ForeColor = System.Drawing.Color.Teal
Me.UsernameLabel.Location = New System.Drawing.Point(277, 92)
Me.UsernameLabel.Name = [Ô]UsernameLabel[Ô]
Me.UsernameLabel.Size = New System.Drawing.Size(220, 23)
Me.UsernameLabel.TabIndex = 0
Me.UsernameLabel.Text = [Ô]&Usuario:[Ô]
Me.UsernameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
[ô]
[ô]PasswordLabel
[ô]
Me.PasswordLabel.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 9.75!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.PasswordLabel.ForeColor = System.Drawing.Color.Teal
Me.PasswordLabel.Location = New System.Drawing.Point(277, 171)
Me.PasswordLabel.Name = [Ô]PasswordLabel[Ô]
Me.PasswordLabel.Size = New System.Drawing.Size(220, 23)
Me.PasswordLabel.TabIndex = 2
Me.PasswordLabel.Text = [Ô]&Senha:[Ô]
Me.PasswordLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
[ô]
[ô]txtUsuario
[ô]
Me.txtUsuario.BackColor = System.Drawing.Color.Khaki
Me.txtUsuario.Location = New System.Drawing.Point(279, 112)
Me.txtUsuario.Name = [Ô]txtUsuario[Ô]
Me.txtUsuario.Size = New System.Drawing.Size(220, 20)
Me.txtUsuario.TabIndex = 1
[ô]
[ô]txtSenha
[ô]
Me.txtSenha.BackColor = System.Drawing.Color.Khaki
Me.txtSenha.Location = New System.Drawing.Point(279, 191)
Me.txtSenha.Name = [Ô]txtSenha[Ô]
Me.txtSenha.PasswordChar = Global.Microsoft.VisualBasic.ChrW(42)
Me.txtSenha.Size = New System.Drawing.Size(220, 20)
Me.txtSenha.TabIndex = 3
[ô]
[ô]OK
[ô]
Me.OK.BackColor = System.Drawing.Color.Goldenrod
Me.OK.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 12.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.OK.Location = New System.Drawing.Point(302, 277)
Me.OK.Name = [Ô]OK[Ô]
Me.OK.Size = New System.Drawing.Size(94, 60)
Me.OK.TabIndex = 4
Me.OK.Text = [Ô]&OK[Ô]
Me.OK.UseVisualStyleBackColor = False
[ô]
[ô]Cancel
[ô]
Me.Cancel.BackColor = System.Drawing.Color.Goldenrod
Me.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Cancel.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 12.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Cancel.Location = New System.Drawing.Point(405, 277)
Me.Cancel.Name = [Ô]Cancel[Ô]
Me.Cancel.Size = New System.Drawing.Size(94, 60)
Me.Cancel.TabIndex = 5
Me.Cancel.Text = [Ô]&Cancelar[Ô]
Me.Cancel.UseVisualStyleBackColor = False
[ô]
[ô]LogoPictureBox
[ô]
Me.LogoPictureBox.Image = Global.Siscom.My.Resources.Resources.User_login
Me.LogoPictureBox.Location = New System.Drawing.Point(0, 84)
Me.LogoPictureBox.Name = [Ô]LogoPictureBox[Ô]
Me.LogoPictureBox.Size = New System.Drawing.Size(271, 254)
Me.LogoPictureBox.TabIndex = 0
Me.LogoPictureBox.TabStop = False
[ô]
[ô]lblData
[ô]
Me.lblData.AutoSize = True
Me.lblData.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 12.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblData.Location = New System.Drawing.Point(12, 9)
Me.lblData.Name = [Ô]lblData[Ô]
Me.lblData.Size = New System.Drawing.Size(63, 20)
Me.lblData.TabIndex = 6
Me.lblData.Text = [Ô]Label1[Ô]
[ô]
[ô]lblHora
[ô]
Me.lblHora.AutoSize = True
Me.lblHora.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 12.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblHora.Location = New System.Drawing.Point(434, 9)
Me.lblHora.Name = [Ô]lblHora[Ô]
Me.lblHora.Size = New System.Drawing.Size(63, 20)
Me.lblHora.TabIndex = 7
Me.lblHora.Text = [Ô]Label2[Ô]
[ô]
[ô]lblAviso
[ô]
Me.lblAviso.AutoSize = True
Me.lblAviso.Font = New System.Drawing.Font([Ô]Microsoft Sans Serif[Ô], 9.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.lblAviso.Location = New System.Drawing.Point(3, 48)
Me.lblAviso.Name = [Ô]lblAviso[Ô]
Me.lblAviso.Size = New System.Drawing.Size(500, 30)
Me.lblAviso.TabIndex = 8
Me.lblAviso.Text = [Ô]Ceretifique-se, de que a Data e a Hora de seu computador estejam corretas, [Ô] & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & [Ô]caso[Ô] & _
[Ô] não estejam. Atualize-as!!![Ô]
[ô]
[ô]frmLogin
[ô]
Me.AcceptButton = Me.OK
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.Color.LightSteelBlue
Me.CancelButton = Me.Cancel
Me.ClientSize = New System.Drawing.Size(508, 341)
Me.Controls.Add(Me.lblAviso)
Me.Controls.Add(Me.lblHora)
Me.Controls.Add(Me.lblData)
Me.Controls.Add(Me.Cancel)
Me.Controls.Add(Me.OK)
Me.Controls.Add(Me.txtSenha)
Me.Controls.Add(Me.txtUsuario)
Me.Controls.Add(Me.PasswordLabel)
Me.Controls.Add(Me.UsernameLabel)
Me.Controls.Add(Me.LogoPictureBox)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = [Ô]frmLogin[Ô]
Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = [Ô]Login[Ô]
CType(Me.LogoPictureBox, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()

Friend WithEvents lblData As System.Windows.Forms.Label
Friend WithEvents lblHora As System.Windows.Forms.Label
Friend WithEvents lblAviso As System.Windows.Forms.Label

End Sub



Desde ja Agradeço.
OCELOT 14/06/2013 10:04:59
#424767
Resposta escolhida
Repare no End Class lá em cima, você colocou todo o código fora da classe e dentro do namespace, você precisa pegar a linha End Class e colocar ela por ultimo nesse arquivo
SAMUELRIBEIRO 14/06/2013 10:11:24
#424768
Bom dia Ocelot

Obrigado pelo retorna e sua atenção

Ja tentei trocar o end class para o final do código, só que ai aumenta o numero de erro, quase duplica.
Página 1 de 2 [13 registro(s)]
Tópico encerrado , respostas não são mais permitidas