List Info

Thread: Public Class does not behave as public.




Public Class does not behave as public.
user name
2006-05-30 15:44:31
I defined it at the beginning of the Form class:

Public Class MainForm
    Inherits System.Windows.Forms.Form
        Public WithEvents TblComponents As new
InMemoryDataTable
.....
End Class

InMemoryDataTable is the class located in a different
project:

        Public Class InMemoryDataTable
                Inherits DataTable

                Public Sub New(ByVal SelectStatement As
String, _
                        .....
                End Sub

                Public Sub New()

                End Sub
        End class

In the main form I assign values to the table instantiated:

        Private Sub MainForm_Load(....) Handles MyBase.Load
              TblComponents = New InMemDataTable(....)
        End Sub

Thanks,

Mauricio B


-----Original Message-----
From: Discussion of writing applications and components
using Visual Basic
.NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On Behalf Of Patrick
Steele
Sent: Tuesday, May 30, 2006 11:38 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Public Class does not behave as
public.

You say you "instantiate the class as Public". 
What is the scope of the
variable?  Where did you define it (not where you
instantiated it) --
local to the Form_Load method?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net
/psteele



-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of Mauricio
Benavides
Sent: Tuesday, May 30, 2006 11:26 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Public Class does not behave as
public.


A windows application in VB.net

-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of Patrick
Steele
Sent: Tuesday, May 30, 2006 11:28 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: Re: [VBDOTNET] Public Class does not behave as
public.

Is this a Winforms app or ASP.NET?

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net
/psteele



-----Original Message-----
From: Discussion of writing applications and components
using Visual
Basic .NET [mailto:VBDOTNETDISCUSS.DEVELOP.COM] On
Behalf Of Mauricio
Benavides
Sent: Tuesday, May 30, 2006 9:27 AM
To: VBDOTNETDISCUSS.DEVELOP.COM
Subject: [VBDOTNET] Public Class does not behave as public.


I have a two projects in a solution. One contains a Class
that inherits
a DataTable. In the second project, I instantiate the class
as Public.



When the form is loaded, I use the instantiated object (a
datatable),
format the table, add records and so on.



The problem I have is that the object exists only when it is
created and
when used in the form load event. Once out of the load
event, the object
does not exist anymore. This doesn't happen if the class
exists inside
the same project, but I need to have it in a separate
project.



How can keep this instance in memory during the time the
program in
open. In other word to behave as public?

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around
http://mail.yahoo.com

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection
around
http://mail.yahoo.com

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )