Can't Access Class From Code-behind. Class Is App_Code Folder?
Feb 15, 2011
I have a very simple class that is located within my App_Code folder in my VS2008 web application project. I am trying to instantiate an instance of this class from my code-behind file. Intellisense does not seem to be seeing my class and I am not sure why. I am using VB.NET which I am admittedly not that familiar with as compared to C#. Perhaps I am missing something. I would bet it has something to do with something I am missing in VB.NET.Here is my simple class (for testing):
[Code]...
View 2 Replies
ADVERTISEMENT
Sep 6, 2011
I have a class named CustomWebAuditEvent defined in App_Code/CustomWebAuditEvent.vb and I'm trying to use it in a eventMappings of my Web.Config
[Code]...
View 2 Replies
Jan 22, 2010
I have some common code that I would like to share between pages and I have been messing around with App_Code classes which is great but I would also like to use code that affects drop down lists example:
Sub Set_FirmType(ByVal Sender As Object, ByVal E As EventArgs)
subcategories.Visible = "false"
supplycategories.Visible = "false"
[code]....
Is their a way to put this in my App_Code class?
View 1 Replies
Oct 14, 2011
I have an ASP.NET website written in VB.NET and trying to add MVC to it.
I managed to add controllers (to CS_Code folder) and make them running. However, I have to use some code from aspnet pages.
When I try to call method from page I ma having compile time error
public CustomerFrontend.DefaultForm DefaultForm { get; set; }
Error:
The type or namespace name 'DefaultForm' could not be found (are you missing a using directive or an assembly reference?)
Page directive definition which proves than namespace is correct:
<%@ Page Language="vb" ValidateRequest="false"
EnableViewState="False"
AutoEventWireup="false"
Inherits="CustomerFrontend.DefaultForm"
CodeFile="DefaultForm.aspx.vb" %>
View 2 Replies
Mar 19, 2010
How would I call a class from the following code?
'Calculate size of Desktop folder
Public Sub Ck_Box_Desktop_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CK_Box_Desktop.CheckedChanged
[CODE].......................
View 3 Replies
Aug 18, 2009
I have some classes, BsfciFile and StudyFlashCard. Bsfci is the extension to which I save my set of flashcards in an INI format. I am currently working to transform my code from using Windows API calls to access the INI to using a IniFile class that I found on the internet. I would like the BsfciFile to have a Array of StudyFlashCard objects, but I would like the StudyFlashCard class to use the IniFile class object contained in the BsfciFile class. I can pass the IniFile from the BsfciFile class to the constructor for the StudyFlashCard class, but I want it to modify the same IniFile as the BsfciFile class has later on.
[Code]...
View 1 Replies
Mar 1, 2010
I need to create unit testing project for my current website. The currentw ebsite si written in VB. All unit testing examples are using interface to create mock object. My current VB class does not implment any interface. Can I add interface and implement it to my current class and functions without affecting or changing codes to any pages in my website that call the functions? For examples my current class is like:
[Code]...
View 2 Replies
Jan 18, 2011
my proble is the following: I have a class MyClass and another class Modifier, which has a method ModifyMyClass(ByRef mc as MyClass) that receives a MyClass instance as ByRef parameter to modify it. A smell of the code is:
[Code]...
View 4 Replies
Jan 11, 2012
How to access controls from class files in app code?
Markup:
<%@ Page Language="vb" AutoEventWireup="false" Inherits="shoppingCart1.ShoppingPage" CodeFile="ShoppingPage.aspx.vb" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
[Code]...
View 2 Replies
Mar 30, 2010
This is a bit of a continuation from a previous post for which AtmaWeapon was very informative.
Problem:
A parent class has a sub class with various properties. A property of the parent class is a List(of T) with T = the sub class The issue is how to store data in the sub class of the instantiated parent
Some example code (hopefully formatted correctly):
Code:
'=========== Class Definitions =============
Public Class courseClass
Public Class timeTableClass
[Code].....
View 7 Replies
Oct 22, 2010
How do I access the base class inside a derived class?
View 1 Replies
Mar 6, 2009
When I started at my current employer I inherited a project from a previous developer and in that project was a data access utility class that tries to simplify a lot of the code involved in making calls and retrieving data back from the database. Over time it has been modified to add more overloaded forms of functions, and now I am looking at possible suggestions from the StackOverflow community.What do you think should be added? Removed?odified?Note:It would be nice if this class could remain compatible to VB.NET in the .NET 2.0 framework. We are also developing in 3.5, but I would like to have something that is generally going to work across most frameworks (so no LINQ, etc.) Also, please refrain from unnecessary answers that consist of nothing but "Use nHibernate" or other tools.
My class:
Public Class DataAccess
Public Shared Function ReturnScalar(ByVal CmdStr As String) As String
[code].....
View 2 Replies
Dec 16, 2009
If Class X is within the scope of Class Y, is X a subclass of Y?If Class A is a sub Class of B, then is Class B considered a super class of A?if Class C inherits Class D is Class D a superclass or parent of Class C?if Class E extends Class F then we can consider Class E a child of F?if Class G inherits Class H and is within the scope of Class I then who is the parent of Class G? Classes that inherits Class J and classes that are within Class J are all sub classes of Class J?
View 1 Replies
Apr 15, 2010
I have put this code in the global form Inherits System.Windows.Forms.Form. And then in the form that will inherit this from the global Inherits MenuStrip. "MenuStrip" is what the global form is called. But keep getting this error: Error1Base class 'MenuStrip' specified for class 'Lesson2' cannot be different from the base class 'System.Windows.Forms.Form' of one of its other partial types.
View 5 Replies
Apr 13, 2010
This is my first major application using multiple classes. It is written in vb and I know about creating objects of the class and using that instance to call functions of the class. But how do I create an object with constructors to allow another program written in C# to access my classes and functions and accept things from the program.
View 3 Replies
Jul 22, 2011
I have a class (see below)
Imports Microsoft.VisualBasic
Imports System.Data.SqlClient
Public Class ClientProfile
#Region "Variables"
[CODE]...
It is in the file ClientProfile I have placed in both App_Code and also App_Code/Models
In my code behind I have the following
[CODE]...
The last word, "ClientProfile" has the scary squiggly red line below it. It is not recognizing my class.Even the Intellisense is not picking up te class. Do I have to register the class file in any way?
View 4 Replies
May 15, 2011
If I have a 'Shared' object defined in the App_Code folder; is that object shared amongst all users/visitors of my website? Or is it shared on a per-user basis?I don't know if that makes sense or not; but I've got a puzzle/solver I'd written earlier that I'm trying to incorporate into a simple ASP.Net site. It's probably poorly written, but I'd used a Shared boolean to determine if a solution had been found. The code works, now as an ASP.NET site, but if two visitors to my site were both validating their puzzle at the same time, would they both be accessing the same boolean?
View 3 Replies
Feb 10, 2011
I can access a module from code behind but not from the aspx page in inline VB code <% ... %>.
View 2 Replies
Sep 11, 2009
Dim a as Type=GetType(className) would gimme the type. But I have only the name of the class as string. I want something like GetType("class1") which would return the type.
View 2 Replies
May 15, 2009
I can't make difference between public class and private class and friend and protected friend class.
View 1 Replies
Jan 21, 2010
I can do this without problem.
Class A
End Class
Class B : Inherit A
End Class
Dim Obj1 As A = New B
View 4 Replies
Feb 28, 2010
While adding two language code files i.e. C# and VB.NET to App_Code, got an error The files ... file names ... use a different language, which is not allowed since they need to be compiled together.Is there a way to add two different language files?
View 1 Replies
Mar 21, 2012
I am creating a simple XML web service and have run into something I can't quite explain.My web service class has the following structure :
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
[code]....
Invoking my method using the built in VS web service test harness works fine. I created another project, in another solution, to test consuming the web service. I added a web reference to my project and set it so I could reference my web service by using "localWS". Then in the page load event of my consuming class I tried to instantiate an object of my web service:
Dim srv As New localWS.MyWS
But there was no "MyWS" type found. There is however a localWS.MyWSSoapClient class. When I use it I can invoke my web methods. My question is, why can't I create a straight up version of MyWS class? In the tutorials I'v read, and in the book I have, example consuming classes for .NET XML web services can instantiate objects of the web service class they are consuming. As a further test I added a new web form to my web service project and from there I was able to instantiate a MyWS class.
View 1 Replies
Jun 7, 2010
Is it possible to use a package class as a folder with the same performance?
View 7 Replies
Aug 9, 2011
so I used to mess around with C#, just a little. And someone had helped me make a class for Visual C# that was supposed to do the math parts for "internal structure" - which the program used for a part of its calculations and screen... Basically there were 2 options. Endo-Steel and Standard. The user would use a updownbox to determine weight of the machine and then internal structure was a % of that total. If it was standard then it was 10% of the overall weight, if it was Endo-Steel then it was 50% of standard (so 5% of total weight) rounded to next 0.5 (so .25 was .5, 1.25 was 1.5, 1.75 was 2.0, etc). I have the code for the C# class file for it, but want to make it in VB.
[Code]...
View 11 Replies
Jan 12, 2012
Is it possible to set a variable in my custom class for Private Read/Write access and Public Readonly access without creating Properties with Get and Set? In other words, from within my class I want full access and from my form I only want read access. Right now I declare my variable as either Private or Public to control Public read/write access. I tried googling my question a bit but I'm not sure what the correct terms even ar
View 5 Replies
Oct 13, 2009
After being spoiled for years with C# automatically setting the default namespace for new classes to match my folder structure, I'm wondering if there is any way to get VB.NET to do the same?
I've been aware for awhile that it doesn't do this automatically but I've never really researched alternatives. keep my VB.NET class namespaces in sync with my project folder structures?
View 1 Replies
Jan 2, 2012
I recently found this code (provided for third party use on another VB site), however,ll of my attempts to insert it into a class library have failed.I open a new class library and past the code in, and immediately get several errors pertaining to how certain objects can't be found. I find it it is crucial to use this code, unless someone can suggest to me another example of existing code that will do the same thing: make a restricted textbox who imputs can be restricted, that can handle pasting, shortcuts, text property setting, and script-entered text.
Option Strict On
Imports System.ComponentModel
Public Class RestrictedTextBox
[code].....
View 9 Replies
Nov 17, 2009
When setting up the Ajax Control Toolkit's AutoComplete control, it creates an utoComplete.asmx and a AutoComplete.vb file. The AutoComplete.vb file automatically ends up in the App_Code folder. I was hoping to move all of these styled-classes into a separate namespace, but the compiler simply does not dig it. Is this possible, or must it be within the presentation layer to access the "Web" related namespaces?
View 1 Replies
May 25, 2009
I've been working on a project the last couple of day with the help of a lot of you out there. I've more or less finished the design of the interfase, but there are stange this happening with the form. I can say much about what is wrong because I dont understand it, but I would like to. I have added the form Class code and the Designer Code, is that enough or is more required? Theres a msgbox that popup in the form Load event which I placed there to see what I could learn about the GraphicsBuffer.
Imports System.Drawing
Imports System.Drawing.BufferedGraphics
Imports System.Drawing.BufferedGraphicsContext
[CODE]...
View 1 Replies