|
-
Nov 21st, 2004, 09:47 AM
#1
Thread Starter
Frenzied Member
Strange Error
Why would this:
MyBase.ShowDialog()
Produce this error:
Object reference not set to an instance of an object.
???
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Nov 21st, 2004, 09:52 AM
#2
Thread Starter
Frenzied Member
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
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Nov 21st, 2004, 09:53 AM
#3
Thread Starter
Frenzied Member
missed one more thing..
If I just do:
Me.DialogResult = DialogResult.OK
by itself in a button I have no problem
Squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Nov 21st, 2004, 02:54 PM
#4
PowerPoster
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)
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Nov 22nd, 2004, 12:08 AM
#5
VB Code:
Me.DialogResult = DialogResult.OK
What are you doing this for?
-
Nov 22nd, 2004, 01:30 AM
#6
Thread Starter
Frenzied Member
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
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|