Prevent Massive Shadowing Of Methods?
Mar 4, 2010
I'm in a project where it's pretty much my first time doing all the architecture myself,and I'm running into a frustrating situation. My architecture for forms seems to be correct from a heuristic perspective, but I don't think its implementation is correct.
My architecture is thus:
Base Class: OrderForm
Child Classes: PurchaseOrder, Invoice, Credit
[code].....
View 4 Replies
ADVERTISEMENT
May 8, 2009
shadowing and delegate method?
View 8 Replies
Aug 5, 2010
Let say I have this class Public Class test End Class when I initialize the class by
Dim x as new Test x. <-- after the "." I can see the below methods
x.Equals
x.GetHashCode
x.GetType
x.ReferenceEquals
x.ToString
View 7 Replies
Jun 22, 2010
i am developing a small windows application in vb.net using visual studio 2005.i want to design a form where user can enter multiple records.like we want to design a "bill" form where user can create the bill for any no of items.there are 4 colmns in it : item no , item name , quantity , price.
my requirement is that if user user a particular item from the list of item in first column then the column "item name" get filled automatically from the database. then user can enter qty , price for that item.on clicking a save button all the data entred by user should get saved in a table in SQL database.
now user can create bill for 1,2 or more items. so no of rows are variable.
HOW could i achieve this using vb.net and SQL server 2005 as databse.
View 2 Replies
Sep 8, 2009
In VB.NET there is a keyword 'shadows'. Let's say I have a base class called 'Jedi' and a derived class called 'Yoda' which inherits from 'Jedi'. If I declare a method in 'Jedi' called 'ForcePush' and shadow that out in 'Yoda' then when calling the method on an instance of the 'Yoda' class, it will ignore the base class implementation and use the derived class' implementation. However if I have an instance of 'Yoda' that was declared originally as of type 'Jedi', i.e. Dim j as Jedi = new Yoda(), and called the 'ForcePush' method on the instance, it will use the Jedi implementation.
Now let's say I have an event that is called 'UsingForce' which is raised when the 'ForcePush' method is called, and I shadow the event out in the derived class (this is because 'Yoda' has an interface 'IForcePowers' that declares this event) and each class raises it's respective event.
If I have an instance of 'Yoda' that is declared as type 'Jedi' (like above) and I put an event handler on the 'UsingForce' event of 'Jedi', and then the 'ForcePush' method is called in the 'Yoda' class, will this event handler be reached?
View 1 Replies
Jun 17, 2012
I finished a database access application that accesses and retrieves data from a database. It was working perfectly fine until i was commenting the code and i decided to test the program again and i found that across all my forms i was getting the same error which is the[code]...
View 3 Replies
May 4, 2011
I have a two windows forms classes, a base class and a derived class. The base class has an event handler which handles ValueChanged on some component. I have also written a different event handler for the same event on the derived class.
When I create an instance of the derived class and fire the event, I find that both event handlers run (the base class one and then the derived class one). But I want only the handler in the derived class to run.
Edit: Here is what the code looks like (can't post the actual code):
Public Class BaseForm
Inherits System.Windows.Forms.UserControl
(Windows Form Designer Generated Code)
[Code].....
View 2 Replies
Dec 4, 2011
It works, but doesn't save what I've changed it to. In the designer everything works fine. I can change the text and have it update on my button control. BUT once I run or rebuild in any way, the text property changes back to it's default value, in my case "Button Control"These are what I've tried, and I've tried all with both Shadows and Overrides - both with identical outcomes. So I've just indicated that with Shadows/Overrides.
vbnet
<DefaultValue("Button Control"), Browsable(True)> _ Public Shadows/Overrides Property Text As String Get Return MyBase.Text End Get Set(ByVal value As String) MyBase.Text = value Me.Invalidate() End Set End Property Private _Text As String = "Button Control" <DefaultValue("Button
[code]....
View 6 Replies
Apr 23, 2009
I have 200,000 rows data need to be inserted into MSSQL 2005 express. I have 4G memory. From the beginning, there is 2.0G used. Then, I use microsoft text driver to load text file into datagridview. Memory rise to about 2.8 GB.I start write data row by row from datagrid view. Memory usage keep rising , then OutOfMemory exception is catched.I try to use GC.Collect and for System.Data.Odbc.OdbcConnection , I also try .Dispose(). But it is no use.How can I keeing the memory within about 3.0GB for this usage ? I monitor .vhost.exe. It rise to more than 1G.
View 2 Replies
Nov 17, 2009
I have a couple of small classes to represent parts in a search filter. If the searched value equals NonValue the filter is supposed to do nothing. This is defined in a Base Class:
Private Class BaseFilter
Protected NonValue As Object
Protected sQueryStringBase As String = "AND {0} {1} {2} "[code]......
When I then create a StringFilter and check for allowed value:
Dim stf As New StringFilter()
stf.CheckNonValue(MyString)
I get a NullReferenceException (NonValue = Nothing) , when I expected the NonValue object to be String.Empty. Is this a bug in my code, or am I trying to achieve polymorphism in a wrong way?
View 3 Replies
May 13, 2011
I have created a new usercontrol. My usercontrol contains several other controls like labels, buttons and so on ...When I set the Font property of the usercontrol I want that font property value to propagate down to the child controls.
View 2 Replies
Feb 21, 2010
I have an ItemsControl in a ScrollViewer. The ItemsControl.ItemSource is set to the Observable Collection.Every time I add an item to the collection, my application nearly doubles in memory usage and eventually after enough adds.
Here is a rough sketch:
<Scrollviewer Name="MyScroll">
[code]....
Using ANTS Memory Profiler, I can see all the class instances in my App. When I start the program, I have 150 instances of TextBox (There are three in the datatemplate). When I add a studyunit to the collection, I have 303. Adding another leaves me with 456... 609... etc.The studyunit objects inherits from dependency objects and I am only binding to its dependency properties. I made the studyunit a series of dependency properties due to this article: [URL], but it didn't fix anything.Update 2/22/2010. Here is the actual code (code above was very simplified and created from memory)
Private Sub ObservableCollectionChanged(ByVal sender As Object, ByVal e As System.Collections.Specialized.NotifyCollectionChangedEventArgs)
If e.Action = NotifyCollectionChangedAction.Remove Then 'q removed
[code]....
View 1 Replies
Apr 4, 2011
Shadows vs. Overrides in VB.Net.What's the difference between shadowing a function in a base class in a subclass and overriding the same function? There is performance issues involved too?I know how to shadow and how to override in VB.net. My question is about when and why should I shadow a function instead override it and vice-versa.
View 2 Replies
Aug 29, 2011
This is the original code in c#
public class CategoryRepository: RepositoryBase<Category>, ICategoryRepository
{
public CategoryRepository(IDatabaseFactory databaseFactory)
: base(databaseFactory)
[Code]...
Does anyone has an idea what i should change to let it work and let my UserRepository use the methods in RepositoryBase while implementing the IUserRepository?
View 1 Replies
Jun 24, 2011
I am working with a vb program, but there is something strange on one of my .vb code pagewhen i put the "dot" afther the object name its dont show the methods availables for this objectbut on other vb code pages i can see it. but in this one no.for exmaplethis is a piece of code: Dim sb As New StringBuilder()
View 3 Replies
Mar 29, 2010
I am not sure how clear my question is by the title, but I am trying to make Class methods instead of Instance methods in Visual Basic that way I don't have to waste memory and code creating temporary objects to execute methods that don't need instance variables.
I am not sure if you can do that in VB but I know you can in Objective-C by using either a "+" or "-" sign in front of the method declaration. And in C++ (at least I think, I can't remember) you put the static keyword or const keyword in front of the function.How would I do this in VB if it is possible? Or should I just make a separate set of functions that are not members of a class?
View 2 Replies
Aug 24, 2010
I have build an application to send "massive" SMS messages, for mobile phones.For doing this, I use 4 GSM modems connect to my computer.About the aplication, it will be used for emergency calls, for firefighters, in my corporation.
The question is:- I can't use SMTP for send sms, cause I dont have Internet conectivity every time. So, this way its not possible. I make the app, sending AT commands to the GSM modems.But, it gives me some problems, some messages are not send, the modems "hangs" frequently, and its necessary restart the computer.
I have heard, that exist another better ways for doing this, but who are using thisr ways, don't tell me how make it.
View 9 Replies
Aug 26, 2010
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim someproc As Process
[Code]...
View 3 Replies
Oct 10, 2011
I'm kind of confuse on how to use get and set in vb how would i access the get/set method within the class and when i instantiate the class somewhere else? in java i would make a 2 methods call like get_item set_item and i can just use the the method name i made. to retrieve or set within the class/object or when i instantiate it somewhere else. but in vb there is a property method and 2 methods inside(set,get)?
[Code]...
View 1 Replies
Mar 28, 2012
I'm trying to use PGK.Extensions in a T4 template in VS2008 for VB.NET and I get:
RemoveAllSpecialCharacters is not a member of string..
My T4 headers:
<#@ template language="VB" hostspecific="false" debug="true" inherits="Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation" #>
<#@ output extension="vb" #>
<#@ assembly name="PGK.Extensions.dll" #> // the dll is found
<#@ import namespace="StringExtensions" #> //Try with and without namespace
[Code]...
View 1 Replies
Jul 15, 2010
I have two methods on the page. One AddMessageToInboxOutbox(params[]) and other one SendNewMessageMail(params[]).
Once user sends an message to other other first message is added to DB and then sent to recipient's email. Sometimes SMTP is heavy loaded and it takes up to 5 seconds to get answer from it. I want to enclose SendNewMessageMail(params[]) with async call using other thread or something. I have never done that.
How do i perform this action right in ASP.NET?
View 2 Replies
Feb 26, 2012
I've seen extended .NET method libraries such as this and this.In VB.NET, since you create your extended methods in a Module, How do I make them into a DLL?? (like in those links above) Its not possible to build and get the DLL from a Module.
View 7 Replies
Feb 27, 2012
I created a couple of extended methods in a VB.NET module. I put them inside a Class, built it and got the DLL. From another program I made a reference to that DLL and imported it using Imports as well.The extended methods appear in IntelliSense and it works but a warning appears in the Error console saying,Could not resolve this reference. Could not locate the assembly "nK0deExtendedMethods". Check to make sure the assembly exists on disk. why this error occurs even though I have referenced the DLL?
This is the Class where I've put my module with the extended method.
Imports System.Runtime.CompilerServices
Imports System.Drawing
Namespace nK0deExtendedMethods
[code]....
And I'm having another doubt. In the Imports statement, I have to mention the DLL's name along with the Namespace name. Like this,
Imports ExtendedMethods.nK0deExtendedMethods
Normally you only have to import the Namespace's name, right?
View 1 Replies
Oct 5, 2009
Is that posible to get all the methods name that handle by a Load event? I want to get Form1_Load from eventInfo.
Dim form As Form = Form1
Dim eventInfo As EventInfo = form.GetType.GetEvent("Load")
form.GetType.GetMethod("Form1_Load", BindingFlags.NonPublic Or
[code]......
View 10 Replies
Jan 28, 2010
I would like to know how to use the graphic methods:
-DrawString
-DrawLine
-FillRectangle
I am meant to use these in a method called Drawgraph in order to draw a grid and bar chart. How can I go about this? What parameters do I need to send? What variables do I need to declare?
View 1 Replies
Jan 23, 2011
Take a look at the code below. Here I create a thread, set its name, and start it:
Private Sub fileCreated(sender As Object, e As FileSystemEventArgs)
Dim processFileThread As Thread = New Thread(AddressOf fileCreatedHelper)
processFileThread.Name = e.FullPath
processFileThread.Start()
End Sub
This is the sub that is the thread: Private Sub fileCreatedHelper()
[Code]...
View 2 Replies
Apr 24, 2010
In VB.NET when i define a subroutine (or function) , while declaring arguments , a list comes out. Having values ByVal,ByRef,Of,Optional, and ParamArray. Of these five lists , four are better understood except "Of". I searched and found that "Of" is used for Generics .Generic Class or Generic Method.
But i did'nt find any procedure that how to create and use Generic Method in VB.NET. I found same in VB.C# language.
View 16 Replies
Mar 13, 2012
I have a vb.net program that opens and populates several excel workbooks with charts. I need to set some chart options. So far, I have:
[Code]...
View 1 Replies
Jan 7, 2010
I would like to know your opinion on extension methods. Sure, it is a nice feature and makes you feel powerful. It's great to see your own method pop up when typing in a object. But it doesn't really add something new... You can get the job done with normal methods as well. I think extension methods do not belong in object oriented programming. It makes your code easier to read but harder to understand for someone else.
View 2 Replies
Jul 16, 2009
I am having trouble doing something that is probably pretty simple!I have a stock listing that is done by 1) a simple form with parameters (Index) and 2) an ajax called partial view that displays the list of stock (based on the params).On this same simple form (Index) I have an action link to an "Add Stock" method which calls another form for adding stock.When the user has finished adding the stock I redirect them back to the stock list page (Index).
My issue is that I would like to "remember" the parameters that were initially entered in this form so the user isn't just directed back to a page with blank parameters forcing them to enter them again.I thought I could simply overload the Index method as such:
[Code]...
I get this error: The current request for action 'Index' on controller type 'StockController' is ambiguous between the following action methods:.Now I have read this post and it's answer but I cannot figure out how to implement the solution. Is this solution applicable in my situation? Is there a better way to acheive what I'm trying to do?
View 2 Replies