VS 2005 Public Class TestClass<T> Where T New()?
Jun 13, 2009What does the "where T : new()" do? VS 2005 public class TestClass<T> where T new()?
View 1 RepliesWhat does the "where T : new()" do? VS 2005 public class TestClass<T> where T new()?
View 1 RepliesI have a class that has timers and logic that I want to "Kill". Performing a TestClass = Nothing does not destroy it (calling it form a form).
View 3 RepliesI have:
Page.aspx
Page.aspx.vb
TestClass.vb
I'm trying to access a shared property of the TestClass class from the Page.aspx.This code works fine:
<head>
<script language="JavaScript">
<% if System.Globalization.CultureInfo.CurrentCulture.Name.ToLower = "pt-br" Then %>[code]......
if it is possible to place the openfileDialog in public class or module? i tried to place it with this code, but it did not work.
Public Sub DisplayDataOnGrid(ByVal gridTable As DataGridView)
Dim filepath As String
Dim OpenExcelFile As New OpenFileDialog()
[Code]....
I understand how the class modifiers work like public, private, protected, friend and protect friend. They are pretty straight forward. However my question is, if I have a class is marked as friend, what should the properties and methods be marked as? Friend or public? Does it matter? I just want my classes at the lowest exposure level that will let my program work properly and that is friend. If I understand correctly, the public properties of a friend class are available to all members of the assembly. Wouldn't that be the same access level if the properties were all friend properties?The reason that I ask is that using the autocomplete feature to make new properties (type property and hit tab) it creates the new properties with the public attribute.
View 4 RepliesI am trying to get a handle on SyncLock and multithreading, but I am having some trouble wrapping my head around exactly how it should be implemented. I have a Public Class Utilities with a many Shared Functions. I want to make sure that each function can only be executed when there are no other concurrent calls to the same function. So If I have 2 functions, A and B in a Public Class Utilities, what is the syntax so that a function "locks" while it is being executed, preventing any subsequent calls until the "locking" thread has completed?
CODE
Public Class Utilities
Public Shared Function A (ByRef i As Integer) As Integer
[CODE].............................
I know I need to wrap the statements of execution in a SyncLock block, but I am unsure of the scope of the parameter used with SyncLock...is it private to the function, class, etc? Can the same object be used to lock both functions if they are independent?
I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.
View 2 RepliesImports System
Imports System.Threading
Imports System.ComponentModel[code]....
how to declare "smsport" on class smscomms as public so that it can be access in class form1 or button1_click event.
I want to created a nested class that can only be visible to and instantiated from the parent class.But I also want to be able to use an instance of the nested class through a public variable of the parent class.I tried making the nested class private, or making the nested class' constructor private, but it won't compile.Is it possible to do this in .NET?
[Code]...
I can't make difference between public class and private class and friend and protected friend class.
View 1 Replieshow to declare an internal class within a public class using vb.net?
View 2 RepliesI'm posting this there is a relationship with my previous post [URL]
I have two projects, namely:
1. Project1 (Windows Application)
2. Project2 (Class Library)
in Project2 there are several classes:
* frmLogin.vb
* frmCustomer.vb
* clsGlobals.vb
in my case, I want to frmLogin.vb and frmCustomer.vb not called in Project1 and I can only call is clsGlobals.vb
I need to convert the following code, so that it exists as a created class "Payroll" that utilizes "Get" and "Set" elements. Unfortunately, I'm completely lost.
Public Class frmPayroll
Private Sub frmPayroll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[code].....
I'm getting an error in .net when trying to declare a Public class on my code behind page.
Partial Class _Default Inherits System.Web.UI.Page
Public someVariable as integer
Public someClass as className
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load [...]
The error I'm getting is BC30508: 'someClass' cannot expose type 'className' in namespace '<Default>' through class '_Default'.The goal here is accessing the class properties in script blocks on the aspx page like this <%=someClass.classProperty%>
I'm not sure if I'm trying the right methods (I've tried several ways of declaring the public class) or if it can even be done..
i am trying to call a public sub within a class that resides within my form1 code:
[Code]...
I am making a program where there is a number of strings are needs and they need to be pre-defined. I rather not store it all in a XML file as I don't want anyone going in and altering them.
Has anyone ever created a class of public constants just to make cleaner code or is it considered bad practice?
I've tried searching... a lot for the answer, but as I'm not too sure what exactly I'm trying to do I can't seem to find anything. I'm trying to write a dll in order to handle errors thrown from a vb.net app. In the dll I need several forms (I'm not totally sure if they can have forms - I'm a bit of a newbie when it comes to dll's) for which the user can type in their message about the error and submit it.
[Code]...
I have a class that is primary configuration for my application. It has 70 plus public collections that holds all my data. I am trying to do a For Each through each of these public collections, so that I can process the data through my code, but I am getting following error:
[Code]...
I've got an issue where Public Events in a class aren't being seen outside the class.
Code looks like this:
Public Class Class1
Public Event Event1(someargs as object)
Public Sub New()
'Perform Some Code
RaiseEvent Event1(someargs)
End Sub
End Class
Public MustInherit Class SingleInstanceForm(Of T As SingleInstanceForm)
Inherits Form
End Class
[code]...
Can i add an event to a Public NotInheritable Class?, in particular i would need to have an event that would listen to property change.System.Web.ClientServices.ConnectivityStatus has a property IsOffline, i would need to know when this property has changed?
Any other way to achieve this?VB.NET to C#[URL]..
I have Errorlog.vb in my vb.net 2008 project. It is for public class. Public Class ErrorLogger I want to call this public class anywhere. So on EACH vb file I use import "mainproject name".ErrorLogger How can I declare once some where at the beginning and that class will be availabe through out the project?
View 2 RepliesI have a form called 'Form1' in my .NET Project.
When I double clicked the form it went into the code editor.
However, I accidently deleted the statement
Public Class Form1
End Class
how can i get this code back?
I have this public class
Public Class commonSettings
Dim etcString As String = "some string"
End Class
How can I call etc String and use it entirely on my code?
Is there any way to make a class instance public?In my mainform I define an instance of a certain class and then later on in some other forms which appear I want to alter this class.I try and pass them through when creating new instances of these other forms and it tells me Error3<instance of the class I want> cannot expose type <the class> outside the project through class <the form I want to edit it with>Which I gather from documentation is about it defeating the purpose to have a private class suddenly be thrown aroudn.but then how do I make it public? I can't define it in the first place as public myXClass as XClass, it only accepts private.
View 6 RepliesI'll try to explain this the simplest way I can, and I'll be happy to provide more elaboration as needed.
I've created a class, class playership, as part of a little strategy game for my own practice.
I've created the instance of a playership object in my main form using the following [code]...
I'm a little confused about this because I thought a public object or variable could be accessed from anywhere within a project.
how can i serialize a class containing a public event + withevents child classes each containing a public event?
View 3 RepliesI am trying to use a DLL that has a public class called FileCleanUp..Inside this class is a procedure called ProcessFiles as shown [code] In VB.Net how do I access the ProcessFiles events so I can inform the user on progress etc from my VB.net application that calls this DLL.By using Reflector have found that the DLL uses the Background Worker if this is of help.
View 1 RepliesI would love to implement the asp.net routing but i have a basic question.
In my Generic handler i have the following Global class
Public Class MyHandlerRouteHandler : Implements IRouteHandler
Public Function GetHttpHandler(requestContext As System.Web.Routing.RequestContext) As System.Web.IHttpHandler Implements
[Code].....
I currently have two forms, and I need to share the value of a variable in one of them.
I declared the variable to be 'Public Shared', and assigned a value to it. However,
when I inspect the value it appears as 'Nothing'. Here is the snippet:
Public Class A
Public Shared sVar As String = Nothing
Private Sub A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code]....