hola que tal, soy nuevo en el foro y no tengo ide de las reglas ni nada, no se mucho de visual basic .NET ,a ver si alguien me puede ayudar...


esto es lo que programe , estoy haciendo un juego y quiero que cuando hago click en el boton OK del form 2 me guarde el nombre que ingreso en una tabla de la base de datos, esta todo con sus nombres y en sus respectivas carpetas: nombre de la tabla TBLNUEVONOMBRE y el de la fila es NOMBRE, Y SE LLAMA bdnuevojugador





aca esta la programacion ( pongo en negrita donde me tira error ):





FORM 1






Public Class Form1
Inherits System.Windows.Forms.Form
Dim principal As Form
Dim danuevousuario As OleDb.OleDbDataAdapter
Dim ds As DataSet
Dim cm As OleDb.OleDbCommandBuilder
Dim dgtabla As DataGrid


#Region " Código generado por el Diseñador de Windows Forms "


Public Sub New()
MyBase.New()


'El Diseñador de Windows Forms requiere esta llamada.
InitializeComponent()


'Agregar cualquier inicialización después de la llamada a InitializeComponent()


End Sub


'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub


'Requerido por el Diseñador de Windows Forms
Private components As System.ComponentModel.IContainer


'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Button5 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button1 = New System.Windows.Forms.Button
Me.SuspendLayout()
'
'Button5
'
Me.Button5.Location = New System.Drawing.Point(208, 232)
Me.Button5.Name = "Button5"
Me.Button5.TabIndex = 4
Me.Button5.Text = "Salir!"
'
'Button4
'
Me.Button4.Location = New System.Drawing.Point(88, 168)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(88, 32)
Me.Button4.TabIndex = 3
Me.Button4.Text = "Acerca de..."
'
'Button3
'
Me.Button3.Location = New System.Drawing.Point(88, 120)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(88, 32)
Me.Button3.TabIndex = 2
Me.Button3.Text = "Cargar Juego"
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(88, 72)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(88, 32)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Guardar Juego"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(88, 24)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(88, 32)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Nuevo Juego"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Button2)
Me.Name = "Form1"
Me.Text = "FOBIA"
Me.ResumeLayout(False)


End Sub


#End Region


Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Close()
End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim nuevo As Form2
nuevo = New Form2
principal = Me
nuevo.Show()
Me.Hide()


End Sub


Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
MessageBox.Show("Autores: Nicolas Holodovsky, Alan Flomembaum y Guido Sirna")



End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim cn As New OleDb.OleDbConnection
cn.ConnectionString = "Provider='Microsoft.jet.oledb.4.0';Data Source='bdnuevojugador.mdb'"
cn.Open()
danuevousuario.Update(ds.Tables("tblnuevousuario") )
ds.Tables("ultimoescenario").Clear()
danuevousuario.Fill(ds, "ultimoescenario")
cn.Close()
cn = Nothing
End Sub


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


End Sub


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim nuevo As Form3
nuevo = New Form3
principal = Me
nuevo.Show()
Me.Hide()
End Sub
End Class


-----------------------------------------------------


FORM 2





Public Class Form2
Inherits System.Windows.Forms.Form
Dim principal As Form1
Dim danuevousuario As OleDb.OleDbDataAdapter
Dim ds As DataSet
Dim cm As OleDb.OleDbCommandBuilder
Dim dgtabla As DataGrid
#Region " Código generado por el Diseñador de Windows Forms "


Public Sub New()
MyBase.New()


'El Diseñador de Windows Forms requiere esta llamada.
InitializeComponent()


'Agregar cualquier inicialización después de la llamada a InitializeComponent()


End Sub


'Form reemplaza a Dispose para limpiar la lista de componentes.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub


'Requerido por el Diseñador de Windows Forms
Private components As System.ComponentModel.IContainer


'NOTA: el Diseñador de Windows Forms requiere el siguiente procedimiento
'Puede modificarse utilizando el Diseñador de Windows Forms.
'No lo modifique con el editor de código.
Friend WithEvents btncancelar As System.Windows.Forms.Button
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtnombre As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.btncancelar = New System.Windows.Forms.Button
Me.txtnombre = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'btncancelar
'
Me.btncancelar.Location = New System.Drawing.Point(208, 232)
Me.btncancelar.Name = "btncancelar"
Me.btncancelar.Size = New System.Drawing.Size(80, 24)
Me.btncancelar.TabIndex = 0
Me.btncancelar.Text = "Cancelar"
'
'txtnombre
'
Me.txtnombre.Location = New System.Drawing.Point(24, 56)
Me.txtnombre.Name = "txtnombre"
Me.txtnombre.Size = New System.Drawing.Size(128, 20)
Me.txtnombre.TabIndex = 1
Me.txtnombre.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(200, 56)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(64, 24)
Me.Button1.TabIndex = 2
Me.Button1.Text = "OK"
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(24, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(96, 16)
Me.Label1.TabIndex = 3
Me.Label1.Text = "Nombre Jugador"
'
'Form2
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.txtnombre)
Me.Controls.Add(Me.btncancelar)
Me.Name = "Form2"
Me.Text = "Nuevo Jugador"
Me.ResumeLayout(False)


End Sub


#End Region


Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtnombre.TextChanged


End Sub


Private Sub btncancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncancelar.Click


Dim f As Form1
f = New Form1
f.Show()
Me.Hide()


End Sub


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


End Sub


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As New OleDb.OleDbConnection
cn.ConnectionString = "Provider='Microsoft.jet.oledb.4.0';Data Source='bdnuevojugador.mdb'"
cn.Open()
danuevousuario = New OleDb.OleDbDataAdapter("select * from tblnombre", cn)


cm = New OleDb.OleDbCommandBuilder(danuevousuario)


ds = New DataSet
danuevousuario.Fill(ds, "tblnombre")
dgtabla.DataSource = ds.Tables("tblnombre")



Dim fila As DataRow
cn.ConnectionString = "Provider='Microsoft.jet.oledb.4.0';Data Source='bdnuevojugador.mdb'"
cn.Open()


fila = ds.Tables("tblnombre").NewRow
fila("nombre") = txtnombre.Text

danuevousuario.Update(ds.Tables("tblnombre"))
ds.Tables("tblnombre").Clear()
danuevousuario.Fill(ds, "tblnombre")
cn.Close()
cn = Nothing
End Sub
End Class














GRACIAS!!!