2 Different Methods Using Same Object Methods?

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


ADVERTISEMENT

Cant See Available Methods List When Write Object.METHODS?

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

Mvc - Repository Pattern Implements Methods By Adding Add1 But Should Use Methods Of The Baseclass?

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

Making Class Methods Instead Of Instance Methods In .NET?

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

Constructor String - Create An Object And Use The Object To Display All Methods

Sep 21, 2009

Under component services, a COM+ component is used by the company, right-clicking it and choosing 'Activation' tab will show the 'constructor string' that is used for DB server connection by all applications. How can I access it the simplest way possible?

[Code]...

View 1 Replies

Creating An Object With Methods?

Mar 25, 2010

In the code below (which I just wrote here - it closely mirrors what my actual code is...) the problem is with the line:

Thing.ThingObject.Add(MyObject)

It says: "Object reference not set to an instance of an object" Yes - it is "nothing" before I try to use the Add method so I must be doing something basic and wrong.The object I am trying to add is fine - I can tell you it is correct, it's just that I apparently cannot use the .add method on the Thing.ThingObject until it is properly created - which I have apparently not done.

Private Sub DoThing()
Dim MyObject as New Object
MyObject = MakeMyObject

[code]....

View 2 Replies

Extension Methods For Object

Nov 9, 2011

I wonder why it's impossible to create and extension method for Object? I use Excel PIA. The property Cells of Worksheet returns Object (if using with indexes). For example, Worksheet.Cells(1, 1) returns Object type. I know it's a Range object, and I want to cast it to Range. It would be convenient to write following:[code]

View 5 Replies

.net - Using Extension Methods From Within An Object's Constructor?

Feb 8, 2010

Consider the following:

Public Module Extensions
<Extension()> _
Public Sub Initialize(ByRef Target as SomeClass, ByVal SomeParam as Something )

[code].....

Why is Case 1 failing to initialize the object as expected?

View 1 Replies

Subclassing Object With Shared Methods

Aug 3, 2009

I want to create a subclass of a class that has some shared methods. These shared methods all call one specific method. But I can't redefine that specific method in the subclass. If I try to make it overridable in the parent class, it says that shared and overridable can't both be used.

[Code]...

View 5 Replies

Initializing Object Variables - Difference Between Methods

Jan 20, 2009

In VB.Net is there any difference between the following three ways of initializing object variables

Method 1
Dim commandObject As SqlCommand
commandObject = New SqlCommand("MadeUpCommand")

Method 2
Dim commandObject As SqlCommand = New SqlCommand("MadeUpCommand")

Method 3
Dim commandObject As New SqlCommand("MadeUpCommand")

Is one more efficient than the others, or are they effectively all the same?

View 3 Replies

LINQ To XML Result Object Not Showing Extension Methods

Jan 9, 2012

I have the code as below:
Dim xdTest As XDocument = XDocument.Load(GetXMLPath())
Dim objResult = From xe In xdTest.Elements("Some Element") _
Where xe.Element("strName").Value = strInput _
Select xe.Element("intValue").Value
objResult.
I cannot access any extension methods for objResult, like .ToList() or .First(). The file imports System.Linq and the project is targeted to .NET 3.5. How do I get the extension methods back?

View 1 Replies

Sender As Object IntelliSense Only Lists 5 Methods And No Properties

Feb 3, 2012

When you type sender. IntelliSense lists 5 methods and yet if you type sender.Left or sender.top these will work. Why don't these properties show up as available for use via IntelliSense.

View 2 Replies

C# - Invoking Private / Protected Methods Via Reflection From The Same Object Instance (or Base)

Jan 5, 2012

Is it possible to call a protected method via reflection. I am using this:

Me.GetType.InvokeMember(Stages(CurrentStage),
Reflection.BindingFlags.InvokeMethod,
Nothing,
Me,
Nothing)

Which always calls a method with no params or return. The idea is that the user of my object (transactional processing of business logic) inherits the base class adds in a load of private methods to fire. They then add these method names to a list in the order they would like them fired and the code above will take care of firing them.

It works fine with public methods but not with private or protected methods in the same class (Protected because I have some 'standard' pre built methods to add to the base class). Realistically I could make the methods public and be done with it but my inner nerd wont allow me to do so...

I am assuming this is a security feature. Is there a way to get around this or does anyone have any suggestions on how to proceed but keep my tasty, tasty visibility modifiers in tact?

(NOTE: ITS IN VB.NET but a C# Answer is fine if that is what you are comfortable with).

View 3 Replies

Use Set And Get Methods In VB?

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

.net - Extension Methods In T4?

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

C# - Using Async Methods Asp.net?

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

Extended Methods To A DLL

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

Extended Methods To A DLL?

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

How To Get Methods Name From EventInfo

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

How To Use Graphic Methods

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

Threads In These Two Methods Different?

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

Use Generic Methods In VB?

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

Using Excel Methods From .net?

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

Why Use Extension Methods

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

.net - Ambiguous Action Methods - ASP.net MVC?

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

.net - Can't Reflect On Private Methods?

Jan 5, 2012

So I created this thread: Invoking Private / Protected Methods Via Reflection From The Same Object Instance (or Base) And we got the problem fixed save for private methods. As this may not be the same issue I thought it may be best to post a different question with the full source. It is still a work in progress but it is functional.

[Code]...

So this class is being inherited by a (so far) empty child class and ProcessStage is being called. Notice that ConfirmFormDataIsValid() sub is private. If you run this it will not find this method. If I change it to protected however it works fine.

View 2 Replies

.net - Extension Methods Error ?

Mar 7, 2011

CODE:

View 2 Replies

.net - How To Add Methods To DataGridView Class

Sep 14, 2011

my question is simple. How do i add methods to the standard DataGridView control of VB.NET

I want to add some methods of my own to the class, but i tried inheritance and i get errors. What are the techniques out there to extend native classes in vb net

View 1 Replies

.net - Invoking COM Properties And Methods

Nov 22, 2010

I am trying to dynamically create COM object, call COM method and set COM properties. The COM class is a VB6 ActiveX DLL. The implementation is exactly equal to the VB6 code from this page

[Code]...

View 1 Replies

Accessing Methods Of MDI From Child?

Apr 30, 2012

I have an MDI form which has got a dynamic menu based on various conditions. Clicking one of the menu items open up a child form, as well as changes the menu again specific to the child form. Now, when I close the child form, I should be able to change the menu back to the way it was before opening the child form.

I have the methods to add/remove the menu items under a menu head in the MDI form. What I tried to do is, in the child form_formclosing event call the methods to change back the menu items the way it was before opening the child form. Debugging through the code I can see the methods are getting called, the menu items are getting changed, however, after the form is closed, I see the same menu items which was there when the child form was open. I have no idea why!

Just to give you an idea about the project, its a very simple MDI form with a number of child forms, using Visual Studio 2010, VB.NET platform.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved