fcoreyesv Posted September 22, 2003 Posted September 22, 2003 I am new in VB.NET. I wanted to create an application using the same techniques in VB 6.0. For my surprise the forms objects are controled differently. this is my code: -------------------------------------- Imports System.Data Imports System.Data.SqlClient Imports System Imports Microsoft Public Class Cypher Inherits System.Windows.Forms.Form Private Sub Cypher_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub mnu_newDoc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnu_newDoc.Click frmNewDoc.Show() End Sub End Class ------------------------- I have this error on the "show" method line ..... "reference to a non-shared member requires an object reference" I am maybe missing a reference but I did not find any example that shows something about this reference. I am waiting for some books of VB.NET but in the mean time I will apreciate your comments. Thanks Quote
aewarnick Posted September 22, 2003 Posted September 22, 2003 You must create a new variable of the type you are trying to use. C# example: Form - the type which is a class. Form f=new Form(); - f, a new instance of type Form. f.Show(); - I show and use f not Form. Quote C#
*Experts* mutant Posted September 22, 2003 *Experts* Posted September 22, 2003 In .NET forms are objects, so you need to create an instance of the Form object to show it: Dim frmNDoc As New frmNewDoc frmNDoc.Show() Quote
aewarnick Posted September 22, 2003 Posted September 22, 2003 We posted at the same time mutant. I gave the C# example, you gave VB. Good work. Quote C#
fcoreyesv Posted September 23, 2003 Author Posted September 23, 2003 thanks Thanks guys, I am working on a project with databases in VB.NET, which book do you recomend ? I found one from Evangelous Petroutsos. Let me know if you know a better one. Thanks again Jose Reyes Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.