Save Method In A Class?

Jan 6, 2012

I have a save method under the save button and i need to put this method in a class of it's own and then call the save from another method which is in another class. the following is the code of the save button[code]...

View 10 Replies


ADVERTISEMENT

Strongly-typed Generic Method Invokes Its Argument's Base Class Method Instead Of A Shadowed Method In T?

Oct 19, 2010

Consider a MyForm class that contains a shadowed implementation of Show(). It also contains a CreateForm() method, which accepts an instance of the form and calls the shadowed sub:

[Code]....

View 3 Replies

Get The Name Of Parent Method/class/file Name Inside Other Method Call?

Feb 16, 2010

I will try to explain what I need.Let's say that I have a class like this:

Public Class Example1 Public Sub ToBeCalled()

[Code]...

View 5 Replies

Create A New Class That Inherits From The Base Form Class And Define A New() Method With Parameters?

Oct 1, 2008

I've been creating short test apps repeatedly to try to understand some of the concepts in VB.NET.For the most part it has been illuminating.I read Bucky's .NET knowlegebase tutorial on passing objects as parameters to newly created forms. He shows how to create a new class that inherits from the base form class and define a New() method with parameters Extending the concept I thought about doing the same thing with a form that was created at design-time (In this case Form2).

[Code]...

View 6 Replies

Call Method Base Class In Program Passing Sub Class Objects?

Apr 22, 2012

Base class has one field to hold numeric balance value. With 2 methods that accept arguments for adding and subtracting the new input calculating new balance. Sub class has four fields dates, transaction, memo and amount.I have a deposit form, and withdraw form. Each time one transaction is entered it creates an object with sub class fields, then adds to the account collection. My problem is not understanding how to call the deposit/withdraw method and pass the current transaction amount back to the base class to alculate the new balance. Does anyone have any links to information/tutorials on how to perform something like this? As you can see with my code I have tried various different approaches without any success.

[Code]...

View 5 Replies

.net - Suppress A Property Or Method From A Base-class In A Derived Class?

Apr 7, 2011

Supose a base class

Public Class airplane
Private var_num_seats As Integer
Private var_num_engines As Integer

[code]....

Obviously, I don't wish that the class Glider has the method "start_engines" neither the property "num_engines". Otherwise, other child classes may have. How can I supress these property and method in child class, not just ignoring (if I can)?

View 2 Replies

Converting String To Class And Dynamically Raising A Known Method Of That Class?

Oct 5, 2010

class

eg: dim classobj = xyz("CLASS_NAME") ' where classname is a valid class name
and dynamically raising a known method of that class on that newly created object or class reference.

[code].....

View 4 Replies

C# - Calling A Method In A FACTORY Class When Application Is Closed / Disposed Without Using Application's Dispose() Method

Mar 28, 2012

I am indifferent if you are a VB.NET or C# or other .NET developer. I have a FACTORY class like the following:

[Code]...

View 2 Replies

Hiding A Method From A VB Class In A Derived C# Class?

Apr 20, 2011

I'm writing a set of unit tests for a large, complex class called ImageEditor from a piece of legacy code, where image processing and GUI functionality isn't strictly divided. One of the methods in the class, BaseImageChanged, seems to be concerned entirely with how images get displayed and should be disabled in my unit tests to avoid unnecessary complexity. The test project is in C#, and the original code is in VB; my idea was to create a Decorator for the class in C# and then hide the method behind an empty one that does nothing. However, when I try running the unit test, the VB code keeps referencing the old BaseImageChanged method as though the replacement didn't exist. Here's what I'm doing:

(VB class)
Public Class ImageEditor
...

[code].....

View 4 Replies

Populate A List(Of Object) In A Class Method, Where The List Was Passed To The Method As A Parameter

Aug 13, 2011

I'm trying to code a class of RandomNumber. One of the class methods needs to populate a "List (Of RandomNumber)" ... which was passed as a parameter to the method ... with 10 random numbers between 1 and 50. DEAD SIMPLE :)

View 6 Replies

Assign A Value To A Class From A Method Within The Class

Feb 13, 2012

I know this is possible, and it is probably something simple that I am missing... I have a fairly complex class to handle deserialization of an XML file. I wish to place a [class].loadfile method within the class. It looks something like this: Serialization decoration left out for simplicity...

[Code]...

The Deserialization is working just fine (that's my own code), but assigning the object value to Me is not correct. What I want is for an instantiation of this class to have a LoadFile method (similar to the XML class LoadFile method) - but I cannot figure out how to set the value of the class from within the class.

View 3 Replies

Asp.net - Inherit Same Method For 2 Different Class?

Sep 22, 2010

How to simplify this, 2 method in class are identical.First class.

Public Class Gui
Inherits System.Web.UI.Page
Public Sub CreateStyleLink(ByVal StyleArray() As String)

[code].....

View 1 Replies

Expression Is Not A Method From Within A Class?

Jan 9, 2012

I am getting an error when trying to call a form from within a method:

Expression is not a method

My code structure looks like this:

Public Class frmMain
Class Server
Private Shared Sub StringMessageReceived()

[Code]....

How can I call the windows form within the class?

View 1 Replies

Inherit Same Method For 2 Different Class

Dec 19, 2010

How to simplify this, 2 method in class are identical.[code]

View 3 Replies

Make METHOD In A Class?

Apr 29, 2012

I want to make an accelerate method that adds 5 to the speed field each time it is called?

[Code]....

View 13 Replies

Using The Same Name For Event And Method Of Class?

Aug 15, 2011

am writing a class that has the same name for events and method, but visual studion won't allow me

The event
public event Close()
the method
Public Sub Close()
End Sub

how can i do this, i don't want to use different names

View 3 Replies

Forms :: MDI - How To Call Save Method

Jan 22, 2011

I have MDI form in different project and child forms in different project which is dll project. How can I call save method of my child form from MDI form when I click on save from toolbar button of mdi parent form. I can't access child forms save method at run time?

View 11 Replies

Add An Extra Method To An Existing Class?

Sep 24, 2010

Suppose that I want to implement another method for a class namely hasFiles for System.IO.Directory , How can I do that?

for example if I add <Extension()> _ tag before each function or Sub I can add a new function or method for each Control.

View 3 Replies

C# - Create A Generic Method In A Class?

Apr 28, 2010

I am really trying to follow the DRY principle. I have a sub that looks like this?

Private Sub DoSupplyModel
OutputLine("ITEM SUMMARIES")
Dim ItemSumms As New SupplyModel.ItemSummaries(_currentSupplyModel, _excelRows)
ItemSumms.FillRows()

[Code]...

View 4 Replies

C# - Invoke A Method On A Class Using Attributes?

May 29, 2012

I want to invoke a method on a class that i have a reference to. The method that I want to call has a custom attributes. Currently I can find this attributes and call the property of my class Attribute.

is there a way to invoke that method ?

PS/ The project is written in vbnet, but I think the solution is the same in c#.

View 1 Replies

Call A C# Class's Static Method ?

Oct 28, 2010

I have a C# dll and want to use it in VB.NET. I'm using C# 2008 Express and VB 2008 Express. I have added a reference in a VB project to the C# dll. When I create an instane of a class in the C# dll, it gives the following error messsage: "Type 'RF.RabinFingerprint' has no constructors". My C# dll code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;[code].......

View 3 Replies

Call A Method From The Base Class?

Jan 3, 2011

REF: http:[url].....The above reference is where I got the code below.This code adds buttons to Form1. When a button is clicked a messagebox appears stating what button was clicked. I want to have the ClickHandler fill a RichTextBox on Form1 (I added a RTB to Form1). My problem is I can't do a Dim xForm As New Form1 to fill the RTB from the ButtonArray Class. I can place my file's text in a MessageBox so I know the code I added is correct. I also tried placing a Property method on Form1 and using a Accessor to fill the RTB, however it also requires Dim xForm As New Form1. How can I get my data from files to the RichTextBox on Form1 from the ClickHandler in the ButtonArray Class? See ButtonArray Class Below.

Imports System.IO

Imports System.Text

Imports System.Collections.CollectionBase[code].....

View 5 Replies

Calling Method From Class In VB 2010?

Jul 18, 2012

essentially I need to create a class that houses the methods and then call the methods in the form but I can't seem to find out what the right code is to call it. I think there may be an issue with the conversion from a double to a string.

This is what I have for the Class

Public Class Aircraft
Dim Names() As String = {"A-747", "A-737", "C-150", "D-240"}
Dim TakeOffVelocity() As Double = {250, 264, 270, 240}
Dim Acceleration() As Double = {33.5, 44.2, 37.1, 51.9}

[code]...

View 3 Replies

Class Modifier For Method Calculate()

Oct 15, 2009

I would like a answer to the following question: For instance:

You have a class called Main. This class created a object of another class called Math.
Class Math has a method called Calculate()
Class Main wants to call this method Calculate().

What kind of modifier should I use for the method Calculate()? I always used public but now I am not so sure... Friend seems to be working as well. What is the best way to do this?

View 8 Replies

Class's Designer ShouldSerialize Method?

Feb 17, 2010

I'm working on a custom control which requires gradient settings. I created a class to contain the data, and it works perfectly, but i'd like to be able to use Reset in Visual Studio. I got that working for each individual data item, but I can't figure out how to get the designer to call my classes' ShouldSerialize and Reset methods.

Code:
<TypeConverter(GetType(ExpandableObjectConverter)), Editor(GetType(GradientFillEditor), GetType(UITypeEditor))> _
Public Class GradientFill
Private colorDark As Color = StyledColors.DarkFocused

[code]....

View 2 Replies

Finalize Calling Class Method?

Mar 21, 2012

I have a logging class that stores entries in a datatable dt. I then use SQLBULKCOPY to write that dt out to a sql table. Basic stuff. Problem is, I'd like to only call SQLBULKCOPY when there's say 50 entries in the dt. The problem is, what if I'm done (either intentionally or not, like if the code block that's using the log class throws an exception) with the logging object and there are still 15 rows in the dt?

View 1 Replies

Get Name Of Current Class Which Calls Method?

Jul 24, 2009

I need to get the name of curent class which calls the method (which parent is another class) from inside of that method. Is it possible in vb.net?

View 6 Replies

Hide A Method In An Inherited Class?

Feb 13, 2010

Is there a way to hide a method of a base class that has been inherited?Lets say the base class has the properties:

x
y
Height
Width

and the method

sub SpecialInstructions()

Now this class is inherited by some classes that either use the SpecialInstructions method or override it. But one class inherits it but cant make use of the method and therefore wants to hide it. I tried shadowing but it still seems that the method is visible ex

Private Shadows Sub SpecialInstructions()

View 9 Replies

How To Mock Method Of A Class Under Test With MOQ

Sep 15, 2011

I have a service class that i want to unit test. The service calls a repository class method in order to save some data. But before I call the save method, I have a validate method that belongs to the service class under test which validates the properies of the class to be persisted as a parameter to the repository save method.I know that to verify that the repository save method is called, i have to mock the repository class and set up the save method, but how do i verify that the validate method belonging to the service class under test is called when unit testing the method under test since they belong to the same class?

View 2 Replies

Method Parameter Name Same As Class Property?

Apr 21, 2010

Is it accepted to have a method parameter named the same as a property? At least it gives no error, even if in the same letter-case.. How does the compiler distinguish? does it always prioritize the local parameter?

[Code]...

View 4 Replies







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