.net - Performance Concerns Of Instantiating Multiple Classes In One Form?
Nov 6, 2009
I would like to know how will performance go when I instantiate multiple classes in one form.e.g
Public Class frmClass
Dim obja As New ClassA
Dim objb As New ClassB
[code]....
View 3 Replies
ADVERTISEMENT
Nov 5, 2009
Which one is more faster between DataTable and SqlDataReader while I'm trying to fill Data into FlexGrid with VB.NET?
View 3 Replies
Mar 18, 2010
I will attach a pic of the errors I have left to resolve. And in addition, when I run it, it doesn't put the CustName and AcctNo in the ListBox. I could attach more code to get a bigger picture of what I'm trying to do. Here is where I have the errors on the list:
[Code]...
View 2 Replies
Mar 29, 2012
I am having this strange thing happen where I have a Module that contains multiple classes in my project. In the Solution Explorer, the module shows up as a Windows Form and if I double click on it to open it, it tries to open the Form Designer. What could be causing VS to think that it is a Windows Form instead of a module?
[Code]...
View 3 Replies
Sep 12, 2011
I have a vb.net web application and when a particular function runs , i get data timeouts in the rest of the application..(ie..row not found errors or column does not belong to table but it does) The function is adding multiple rows in multiple tables in the database and is running in a for loop. It seems to be all SQL related but I am not seeing anything in the error logs in SQL or in the application Right now I am assuming it is memory related where to start note..the for loop will be replaced with a bulk insert but right now I jest need to resolve the issue of the timeouts
View 1 Replies
Nov 15, 2009
When an instantiated class calls a method in the parent form class, VB.NET starts a new instance of the form class instead of calling the method on to the active one.How do I tell it that I have just one instance of my form class, or that I don't want to create a new instance of the form and just call the method on the already active form?
View 2 Replies
Feb 11, 2011
Which one is best approach out of the following? Or Both has same effect ?
Dim carrierName As String
Dim someotherName As String
Dim anotherOne As String
[Code].....
View 4 Replies
May 30, 2012
I'm implementing a poor-man's ORM an a legacy application (.NET 2.0 web app, hand-coded SQL queries). I have two data classes: Customer and Order:
Public Class Customer
Public Property CustomerId As Integer
Public Property CustomerName As String
[code]....
I'm concerned about the performance of this method, namely if I'm pulling multiple Customer's. For each Customer pulled, I have to hit the database again (opening another connection), and getting the orders for that given customer. If I'm not mistaking, it wouldn't take many records to accumulate a large number of open connections.
How can I determine the number of new connections being made and whether or not I'll encounter any connection pooling or other such .NET-imposed limits?
One thought I've had is to pass the SQLConnection object created in the calling class to the getOrdersByCustomerId function and have that function use the (apparently?) already-open connection. I have not tested it namely because I don't know how to determine if it's better than my existing method. Thoughts?
I'm creating a search web service that returns JSON for processing by the client. The service takes a single search parameter, performs multiple lookups on different tables, then returns a custom JSON object. For example, if the user puts in what appears to be a name, I search both the Customers table for a list of the top n customers and the Orders table for the top n orders that have a customer with that name.
View 4 Replies
Nov 10, 2009
What are the different methods for injecting cross-cutting concerns into a class so that I can minimize the coupling of the classes involved while keeping the code testable (TDD or otherwise)?
For example, consider if I have a class that requires both logging functionality and centralized exception management. Should I use DIP and inject both required concerns via an interface into the class that requires them? Should I use a service locater that I pass to each class that will require some cross cutting functionality? Is there a different solution altogether? Am I asking the wrong question entirely?
View 1 Replies
Sep 10, 2009
I downloaded a .net component that I would like to make consumable by COM clients. This component allows one to create a DXF file (Cad drawing). The problem is that the component is composed of quite a few class files, some inherit another. All the examples I found only show one file no namespaces etc. [Code]
View 1 Replies
Mar 19, 2012
I want to use this Structure in multiple .vb files within my project:
Structure MyStruct
Dim Name As String
Dim Good As Boolean
End Structure
If I define it in one file, the other files can't use it. How do I define it globally?
View 1 Replies
Jun 7, 2011
I have created a read-only property(name) in class1. How can I use this name property in class2?
Public Class Class1
ReadOnly Property name() As String
Get[code].....
Can I directly carry this name variable value into class2?
View 3 Replies
Mar 23, 2010
I am wondering the best way to store an object in memory that is used in a lot of classes throughout an application. We have multiple databases, 1 per customer. We also have a master table and each row is detailed information about the databases such as database name, server IP it's located and a few config settings.
I have an application that loops through those multiple databases and runs some updates on them. The settings I mentioned above are updated each loop iteration into memory. The application then runs through series of processes that include multiple classes using this data. The data never changes during the processes, only during the loop iteration.
The variables are related to a customer, so I have them stored in a customer class. I suppose I could make all of the members shared or should I use a singleton for the customer class? I've never actually used a singleton, only read they are good in this type of situation. Are there better solutions to this type of scenario? Also, I could have plans for this application to be multithreaded later.
View 3 Replies
Jun 21, 2009
I'm a long-time developer but semi-new to Visual Studio .NET and VB.NET. I've been working on an application for months, written in Visual Basic .NET. It's a rewrite of a popular IDE of mine that's originally written in assembly. What I'm trying to do in VB.NET is have multiple TabPage classes that inherit from TabPage, ofcourse, but each having it's own methods for common functions like Cut, Copy, Paste, etc. so that when I call tab.Cut(), the TabPage class for the currently-selected tab is the one used. In each custom TabPage class, I'll have a New instance of the main control that goes in that tab.
I think there would be a problem when I loop through the TabPages since the Foreach routine can only use one object type, as far as I know (TabPage).Currently I have only one custom TabPage class called Page that obviously inherits from TabPage, has additional properties and also methods that allow editing functions for whatever control is selected to be displayed for the tab. For example, when I call the New constructor, I supply the editor type as a parameter: dim tab as New Page(HEX_EDITOR).I have edit controls such as text, syntax editor, hex editor, bitmap editor, HTML editor, HTML browser. This means I get a new instance of all of those controls each time a new Page is added to the TabControl. I'm currently disposing of the unneeded editors depending on which editor is the one needed. The scheme is not preferred but it works great for now as I work on other areas of the IDE.
[Code]...
View 3 Replies
May 9, 2009
I have one class with <Serialize> attribute called Tree. And Tree class has an arraylist of TreeNode classes. Is it possible to use Soap to convert the Tree class and arraylist of TreeNode classes to one xml file or binary file? If it is possible, do i need to use <Serialize> attribute on TreeNode classes too? If not, what should i do then?
View 3 Replies
Jul 16, 2009
In a project of mine I'm currently doing this:
[code]...
all classes inherit docMain and addTemplateToList( X ) adds x to a List(Of docMain). Now my question is: Is there a better way to do what's done in the code sample? I thought of something like:
[code]...
Is this somehow possible in VB.net (Reflection?)?
View 3 Replies
Jan 13, 2011
I am integrating two disparate data sources where each value may depend on one or more other derived elements.This app runs as a windows service.Currently all my code is in a single class.I am upgrading to 2010 and wondering if best practices would be to break out my functions into multiple classes - there are over 100 data elements that need to be constructed. The following is an example of a couple derived items:(Is there a better way to do this - when complete I will pass this app off to someone else to support and want to make sure I give them the best beginning.[code]......
View 2 Replies
Oct 26, 2011
Is it possible to have multiple classes in a namespace and be able to reference the functions within the clases if the Major class is instaniatated from another class?? for instacnce:
Namespace Database
Public Class Data
Public Class Prepare
[code]....
View 1 Replies
Jan 30, 2012
I'm still teaching myself how to bind and use observable collection. One problem that I'm a little confused on is binding multiple classes/observable collection to one page. In other words, if I have a PersonName class and a AnimalName class, I have to create two separate observalbe collections for each? How would I set the datacontext when a page only allows one?
[code]...
Now If I add another class, how would I combine the two on the binding part and collection part.
View 2 Replies
Mar 6, 2009
Okay, say I have a class named "ChannelList", and it raises an event named "FoundChannel"
But what I'M wanting to do is create multiple classes of different names that use that class, but I want to have all of the "FoundChannel" events be handled under one single sub routine?
View 15 Replies
Jul 26, 2011
I want to be able to incorporate some constant definitions and enum types in multiple classes of mine.Something akin to including a header file in C++. How do I do this best in VB.NET? I'm having a hard time because the only way I can see to do it is to inherit a class with the definitions in it but there is no multiple inheritance in vb.net so I am having some issues with that.
View 6 Replies
Feb 13, 2012
while making my irc bot i need to send many different irc commands such as join channel, change mode, kick user message, topic channel message and so on. All these commands are currently process individually in a public sub on the irc connection thread.
Public Sub Write(ByVal command As String)
_streamWriter.WriteLine(command)
_streamWriter.Flush()
[Code]....
Would you have a load of public sub's to handle each or maybe something else?
View 2 Replies
Feb 23, 2012
I'm developing a new functionality for web site project with VB.NET default language in VS 2008. As my preferred language is C# I create subfolder for C# code in the App_Code folder and add appropriate codeSubDirectories element to web.config file. The problem is that I can't refer VB.NET classes in my C# code. All VB.NET classes and structures are placed in global namespace in the App_Code. But even if I place some VB.NET class in the same namespace I've use for my classes in C#, I still can't use them.
View 2 Replies
Aug 18, 2011
We are developing a webservice for a client. We are not supose to throw SoapExceptions, so instead, we catch every exception server side, and return a custom Exception class.
Public Class Order
...
End Class
[Code]....
The problem now is, that since my webmethod is returning the type [Object]. The wdsl that is generated does not contain the order, or the exception.
I can change the [Object] to [Order] Or [MyException], but only one of them is generated in the wsdl.
I want both the MyException type and the Order type in my wsdl, but i just cant get it working.
View 2 Replies
Apr 6, 2010
I am in college taking computer programming and we are now in multiple classes and forms. It was very hard to get ahold of at first but now that I understand it a bit better I am curious as to how often in a professional enviornment do developers create multiple classes for a project? Besides the use of custom functions what else is beneficial for it?
View 4 Replies
Feb 3, 2011
2. FunctionLayer -deals with Common Operations which get results from DataLayer and return results to Forms.3. User - deals with User. (For Reusing the User Class in other projects, i have separated this class)Here in Class2 - I have an instance of Class1( ie., DataLayer) for DB Operations.imilarly in Class3- I have an instance of Class1( ie., DataLayer) for DB Operations.Now in my form, If i create Instance of Class2. But When I need user functionality in this form, I have to create an instance of Class3 to this form.
View 6 Replies
Mar 30, 2012
I am trying to get all assemblies in CurrentDomain using AppDomain.CurrentDomain.GetAssemblies() to write their FullName into a DropDownList, however if I don't instantiate them, they are not seen in returned array from GetAssemblies() in CurrentDomain.They are all added as Reference and in Reference folder of the solution. Only time I can get them from the GetAssemblies() is when I first instantiate them.How to overcome this problem with an easy and more generic way instead of instantiate them everytime when I add new Assembly, etc.Due to company policy, I have to obfuscate some parts of the images: All the assembilies are referenced in Reference folder:
View 3 Replies
Nov 23, 2011
This question is about a different instance that im trying to instantiate...I have to get the "Read" function from my Cardreader class and return a string to it on the form1.vb .... Now i did what i can remeber but for some reason i'm having a problem with the brackets.... What can i do to fix this?Form1.vbThisATM.getCardReader.Readr("TEST TEXT IS FUN")
CardReader.vb
Public Function Readr(ByVal card As KeyCard) As String
Return Read
[code].....
View 1 Replies
Sep 23, 2009
My VB project is large enough that it requires several files. It was originally developed as a Console App and I created each file as a MODULE. All modules could use subroutines, data structures and constants from other MODULES and everything worked fine. I needed to add basic windowing to the app and this required that the app be converted from a Console App to a Windows Forms App. The main window is Form1 which is not a MODULE but a CLASS. The problem is that some MODULE based functions cannot access subroutines, data and constants that are defined within the CLASS Form1 unless they are incorporated into the CLASS file and this makes the CLASS file very large. If I add a new Class file to the project, it also cannot interoperate with Class Form1 in the same way that multi-MODULE code interoperates.
How does one spread CLASS code across several files and still allow it to interoperate as if it were in a single file? Alternatively, how does one create several CLASS files that operate the way multiple MODULE files operate.I am sure that there are all kinds of best practices that I am violating but the goal to to get some prototype software working and interfaced to some lab equipment.
View 2 Replies
Jul 27, 2010
I am in the middle of (trying) to create a Class Library available for use in VB6/VBA. With some assistance received here I have now done the following:Created a Class Library Project in Visual Studio 2010 Express and put the code in a Class Module.Learned I needed this wonderful thing called an "Interface"... Made one of those:)I opened the project properties and went to "Assembly Information" and checked "Make COM Visible".I went to "Advanced Compile" options and targeted .Net 2.0 (it's very simple code).Removed all references expect for "System".Built the project (no warnings or errors) and copied the DLL out of the Bin folder into C:WindowsSystem32 Ran RegAsm /tlb. Everything seemes just fine.I popped open excel to run a quickie test and the TLB is available but I have two problems:
I can see both the class and the interface in the Object Browser/Intellisense.When I try to create an instance of either object (Set obj = New MyObj)I get the error:I can set a reference to the Object and the Intellisense can see it, I just get that error when I actually try to create the Object. Did I miss a step?
View 1 Replies