New Static Fields And Hiding The Public Inherited Members?

Feb 3, 2010

Curious situation:
public class MyTextBox : TextBox
{

[code].....

View 1 Replies


ADVERTISEMENT

Asp.net - Access A Module Or A Public Class With Public Shared Members From Inline Vb Code <% .. %>?

Feb 10, 2011

I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.

View 2 Replies

Inherited Members In Interfaces?

Apr 21, 2010

When I pass an an object 'MyObject' which implements 'IMyInterface' to a method parameter declared as IMyInterface, I understand that this method parameter 'sees MyObject through the eyes of its interface'.

View 2 Replies

Polymorphism And Shadowing Inherited Members?

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

Visibility Of Static / Shared Members

Dec 30, 2009

I have faced with a situation in VB.NET and C# (.NET2) with the visibility of the static/shared members. It seems to me a little strange in VB.NET:

public class A {
private static A instance;
public static A Instance {
get { return instance; }
} public string Name { get { } }}
[Code] .....
Shared member behaves like a class public one I can repeat it to infinite..

View 3 Replies

Hiding Non Overridable Property In Inherited Control

Jan 9, 2012

I've removed the properties completely with a controlDesigner class, but I'm getting warnings + trying to do it properly to remove those warnings.

View 6 Replies

C# - Best Practice For Complex Shared / Static Members

Sep 7, 2011

I took over an ASP.NET application and have found this throughout several classes in the application. The programmers before defined several shared/static variables that act as "complex enums" throughout the application. As a fairly new programmer, it doesn't look like best practice.

Here is an example:
Public Shared SecureCommentsWrite As New Task("Secure Comments Write")
Public Shared SecureCommentsRead As New Task("Secure Comments Read")
Public Shared EditEmergencyContact As New Task("Edit Emergency Contact")
Public Shared DisplayPersonalReferences As New Task("Display Personal References")
Public Shared EditPersonalReferences As New Task("Edit Personal References")

The constructor takes the description, then loads the ID key from the database using a stored procedure (the database is SQL Server.) This seems like a good idea since we deploy this application to multiple databases and want to ensure that we load the ID key that's in that database in case it changes. However, since there are literally hundreds of these in the application, the first load takes a while.

View 4 Replies

IDE :: Inteliscence Vs2008 - Not Seeing All Public Members ?

Feb 27, 2009

I am noticing i am not seeing all public members when i should an example:

Imports System.DataImports System.Data.CommonImports System.Data.SqlClientImports System.Data.OdbcImports System.Data.OleDbImports System.Data.OracleClientImports System.Configuration Dim builder As New SqlConnectionStringBuilder (NOT SHOWING) With builder .InitialCatalog =

[CODE]....

View 2 Replies

C# - When Should Use Public / Private / Static Methods

Apr 27, 2009

I'm new to C#.Till this moment I used to make every global variable - public static.All my methods are public static so I can access them from other classes. I read on SO that the less public static methods I have,the better.So I rewrote my applications by putting all the code in one class - the form class.Now all my methods are private and there's no static method.

My question: What should I do,keeping everything in the form class is dump in my opinion. When should I use public,when private and when static private/public? I get the public methods as a 'cons' ,because they can be decompiled,but I doubt that.My public methods can be decompiled too.What is so 'private' in a private method? EDIT: I'm not asking how to prevent my program to be decompiled,I'm asking whether I should use static,private and public.And also : Is there are problem in putting all the code in the form class so I dont have to use public methods?

View 6 Replies

Private Fields Have To Be Declared Static?

Aug 18, 2010

I am a vb.net programmer switching to C#.I have the following code for a console application (targeting NET20)

using System;
using System.IO;
using System.Data;[code]....

This is giving a compile error in the if clause of InitVars for the _dbName variable:

Error 1 An object reference is required for the non-static field, method, or property 'eScoreSwapper.Program._dbName' C:UsersSethSDocumentseScoreVersionsTrunkdotNeteScoreSwappereScoreSwapperProgram.cs 26 38 eScoreSwapper

C# does not allow you to reference private class fields unless they are declared static?

View 7 Replies

Take Some Existing Classes We Retrieve From A Web Service And Hiding Public Functions?

Nov 18, 2009

[code]...

EDIT: The above class is just an example of what could be returned from a web service. I won't have access to modify it at all, sorry if I didn't make that clear.Is it possible to somehow make a clone this class, so that it retains all of the properties values, but hides the fact that there is a Public function?I'd like to be able to take some existing classes we retrieve from a web service(which we didn't write) and be able to pass them on for use in an application, but without exposing the functions. I don't want to go down the route of creating my own classes that specifically define each property and write the values in (due to the sheer size of some of them), so I'm looking to see if there is anything dynamic I can utilise (maybe there is a way using reflection?).

View 4 Replies

Main Array That Is A Structure With Three Fields Which Consists Of Id_code(int), Members(int) And Annual_income(dec)?

Mar 2, 2010

I have a main array that is a structure with three fields which consists of id_code(int)members(int) and annual_income(dec). I've get everything entered and I want to go to a procedure that prints a report giving the total percentage of families below a particular income and the level is different depending on how many members there are in the family.

Option Strict On
Public Class Form1

[code].....

View 6 Replies

Imports System.Xml - Error Namespace Or Type Doesn't Contain Any Public Members Or Cannot Be Found?

May 2, 2010

I'm setting up a simple XML read-write demo (VB Winforms) in Visual Studio 2010 Premium (tried in both the RC and RTM) and added:

Imports System.Xml

Result: Error Namespace or type doesn't contain any public members or cannot be found...

VS 2008 equivalent example recognizes the Imports statement fine.I know this has to be me, but I'm stumped.

Note: I tried this with the app targeting both .Net 3.5 and 4.0. Same result.

View 4 Replies

Asp.net - Updating A Hybrid DetailsView (with Static And Dynamic Fields)?

Dec 12, 2011

I've got a DetailsView which has some static fields defined in my markup and adds some extra fields dynamically in the VB codebehind. It should be noted that the DetailsView lives in an UpdatePanel.Assume that I would like to get inventory information for a number of warehouses, but I only want to see those which have stock on hand. In addition I have some static information such as product, sku, etc.

The problem I was having was that every time I clicked the "Details" button it would just keep appending the dynamic fields to the end and never re-rendering the table. I figure I either need a conditional or to tell it to re-render somehow. I suspect this problem arises from my use of the UpdatePanel but it's important for the user experience of my customer to keep this.

'Warehouse Stock by Location
Dim stockDT As New DataTable
For Each row As DataRow In stockDT.Rows 'Add column for each Warehouse that has stock

[code]....

View 1 Replies

Permission Denied / Cannot Call Non-public Or Static Methods Remotely

May 17, 2010

There are no "non-public" or "static" methods in my code. All are public. What I'm trying to do is pass a FrameworkElement (more specifically a web browser control) that was created in one process over to another process for display and use. Also I'm not using (and would to avoid using) any of the framework 3.5 addin stuff.[code]

View 2 Replies

.net - When Run Code Analysis VS2010 Wants To Add Property Infront Of All Of Public Members (CA1051 : Microsoft.Design)

Jan 24, 2012

When running code analysis on my project, I receive the following message:

CA1051 : Microsoft.Design : Because field 'ClassName.VarName' is visible outside of its declaring type, change its accessibility to private and add a property, with the same accessibility as the field has currently, to provide access to it.

Public VarName As String to this:Public Property VarName As String

I don't understand why the Property keyword is so important in this particular case. Can anyone provide an explanation as to why changing this member to a Property makes a significant difference to code analysis?

View 4 Replies

VS 2010 Using Reflection Difference Between Static And Instance Fields And Properties

Jun 6, 2012

I'm trying to obtain the values using the prospective GetValue(s) methods but I don't understand the syntax of the documentation. I'm sending the correct bindings (I believe) to filter the fields, and properties that i'm interested in usually

[Code]...

View 3 Replies

Initializers On Strcture Members Are Only Valid For Shared Members And Constants?

Jan 5, 2010

ok this is annoying, i've got a structure RInteger.

Private VAR_Value As Integer
Private VAR_Max As Integer
Private VAR_Min As Integer

[code]......

View 5 Replies

Base Form And Inherited Other Forms From It - Don't See Those Changes Take Effect In My Inherited Forms?

Jun 24, 2010

I have a base form and I inherit other forms from it. However, if i go back and change say the size of the base form, I don't see those changes take effect in my inherited forms. Does anyone know why that is? Is there a solution to this issue?So as far as design is goes, what exactly gets inherited by other forms?

View 9 Replies

Declare A Public Param For Public Class Form1?

Apr 7, 2011

Imports 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.

View 5 Replies

Declare A Public Variable And A Public Sub In An Aspx Webpage?

Aug 26, 2010

How do declare a public variable .aspx web page that can be used in all the pages within my web application?

View 3 Replies

Refactoring A Module Into A Class: Changing Shared Fields To Instance Fields

Nov 14, 2011

I'm currently refactoring an old Visual Basic DLL (VB.Net), which stores all of its data in one module called Globaldefinitions as public fields. There are about 200 fields, referenced thousands of times all around the code:

Public Module Globaldefinitons
Public a As Short
...
Public zz10 As Double

[Code]...

I need to change the module into a class with non-shared fields. This means, each and every of these thousands of references needs to reference the instance of that class:

globalDefinitionsInstance.a = 5

How do I go about this efficiently?

Regular expressions operating on the source fall flat. Refactoring tools like Re-Sharper or CodeRush don't seem to offer this functionality. Visual Studio 2010 cannot do it automatically either.

View 2 Replies

Can The Initialization Order Of Class Fields In .NET Be Influenced By References To Other Fields

Jun 19, 2011

Class Foo
ReadOnly name As String
Public Sub New(name As String, dependentUpon As Foo)
Me.name = name

[code]....

The output of New Bar() is:

Dependent created. Dependent upon nothing.
Independent created. Dependent upon nothing.

It seems fields are initialized in the same order as they appear in the source code, which (a) leads to an unexpected result, and (b) seems a little puzzling, given that one is normally not permitted to read from uninitialized variables in .NET, yet that seems to be working fine above.I would've expected VB.NET to be smart enough to initialize referenced fields first, and only then those that reference it; i.e. I'd have liked to see this output instead:

Independent created. Dependent upon nothing.
Dependent created. Dependent upon Independent.

how to get VB.NET to behave like that instead, without simply having to swap the declaration order of dependent and independent inside class Bar?

View 1 Replies

Create Word Form Fields With Memo Fields From Access?

May 27, 2012

I'm trying to create a table in Word using data from a table in Access. There are four fields in the access table that I need. 3 fields are text which I can populate the Word without any issues. However the fourth field is a memo with >255 characters.I'm struggling to come up with the proper code to allow me to populate the Word field with the memo data that has more than 255 characters. The code I have so far is listed below. But when it hits the memo field, it crashes on the line I marked with **. I know it's not text, but I've tried many different field types, but nothing has worked so far.[code]...

View 1 Replies

Validating Login Fields - Check The Username And Password Fields

Jan 14, 2012

My intent is to have the code - on a button.click event - check the Username and Password fields and return an error depending on which is wrong. Or if both are wrong, return a different error message. I've set the username as parts and the password as parts (still learning how to use external authentication). [Code]

View 2 Replies

Gridview Combine Autogenerated Fields And Template Fields

Aug 17, 2010

I have several sqldatasources for my gridview. All of the columns are autogenerated. However they all have some consistent fields and I'd like to make those fields template fields so I can modify the edit template for them such as adding a drop down menu. Is this possible?

View 1 Replies

C# - MS Word Office Automation - Filling Text Form Fields And Check Box Form Fields And Mail Merge

Sep 3, 2009

experience on how to create an engine using C# (VB.NET is okay too) that is generic enough to handle most cases of MS Word text fields I need to fill with data I'm getting from a database? In short, I'm about to embark on this little Office automation excursion and I'm hoping a little bit of feedback here.

View 2 Replies

Database - Compare Two Fields In An SQL SELECT Statement To Then Select Other Fields Based On This Result?

Apr 8, 2012

I have a table which contains a list of products for a company. They input data about how much stock they have and also the level at which they want to be reminded that they need to order new stock.

[Code]...

I want to list all the true results in a form which the user is then able to navigate through. What would be the best way to go about doing this?

View 2 Replies

Combining Multiple Table Data With Different Fields Into A Single Table With All The Fields?

Feb 13, 2012

how to execute this SQL Statement

Scenario:
Given Tables T_Data, T_AllDesc, T_System1, T_System2
Given Fields:
T_Data= f_id, f_Desc, f_CreationDate, f_CreationTime, f_System1, f_System2

[Code].....

View 7 Replies

List Members From AD?

Oct 24, 2011

Im trying to search the entire active directory to look for a group and then see if the current logged on user is listed, then take an action based on that result.So far i have the below code which doesnt return the users who are members of the group MyTestGroup. Could anyone assist or guide me to see how i achieve this?

View 4 Replies







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