Why would this:
MyBase.ShowDialog()
Produce this error:
Object reference not set to an instance of an object.
???
Squirrelly1
Printable View
Why would this:
MyBase.ShowDialog()
Produce this error:
Object reference not set to an instance of an object.
???
Squirrelly1
And it only happens when I execute the following code:
VB Code:
If Not LCase(txtPassword.Text) = LCase(txtConfirm.Text) Then Exit Sub Dim Changed As Boolean = False Dim Conn As New OleDbConnection(ConnectionString) Dim Cmd As OleDbCommand = Conn.CreateCommand Cmd.CommandText = "SELECT UserName, Password FROM Users" Conn.Open() Dim DA As New OleDbDataAdapter DA.SelectCommand = Cmd Dim DS As New DataSet DA.Fill(DS, "Users") Dim NewRow As DataRow NewRow!UserName = txtUserName.Text NewRow!Password = txtPassword.Text DS.Tables("Users").Rows.Add(NewRow) Dim CB As New OleDbCommandBuilder(DA) DA.UpdateCommand = CB.GetUpdateCommand DA.Update(DS, "Users") MsgBox("Added New User!", MsgBoxStyle.OKOnly, "Success") Me.DialogResult = DialogResult.OK
missed one more thing..
If I just do:
Me.DialogResult = DialogResult.OK
by itself in a button I have no problem
Squirrelly1
Hi,
I'm probably missing the point entirely but I thought you used MyBase to refer to methods in the base class which you have overridden in the instanced version but want to access. So, why would you expect to be able to show the base form when you have not created an instance of it? (The instance from which you are doing the calling does not count)
VB Code:
Me.DialogResult = DialogResult.OK
What are you doing this for?
I did that so it would return from the dialogbox back to the calling form.
The problem is not with MyBase afterall... it is with the code I tried to implement to add a new record to my database... it's screwed up
squirrelly1