Asp.net - Moving Common Routines To The App_Code Class?

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


ADVERTISEMENT

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

.net - Using A Class Defined In App_Code In Web.config

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

Moving Modules/classes/forms To A Common Folder?

Nov 23, 2009

I have two projects

a.sln and b.sln they have their own classes, modules and forms.

As I work on solution 'A' I devise a class and save it in solution A's folder. As the class develops, I now find a need for it in solution B.

How can I move it from solution A's folder to my Common folder then link it into solution A and B.

Currently I am doing this manually, Moving then linking to it. Is there a way to do this withing the IDE

View 14 Replies

Generics - Create A Common Database Class In .NET?

Jun 12, 2009

We have 3 databases providers we use to connect to our databases: DB2, MS SQL, and Interbase. I would like to create a single generic database wrapper class that can be used to talk to all three just by passing in the correct connection string, username, password, and the provider desired.

I don't want to have to add references and import all three providers in the database class. Is this possible?I have done this before in Java using the Class.forName() function.

View 4 Replies

How To Avoid Writing Common Code In Derived Class

Jun 28, 2010

I am trying to minimize my code writing. I have DBLayer base class that selects, inserts, updates and deletes records from database. I need only fieldlist and table name from each derived classes to perform the actions. I have defined static tablename, fieldnames in derived class. Currently I am defining next static functions in derived class for GeneralSelect [which selects all records], GeneralInsert[Which inserts a records], GeneralUpdate[Which updates records as per given id] and GeneralDelete[Which deletes a record of the given id]. The parameter and all functioning are same just the differece is the table name and fieldnames.

One DBLayer Class that performs database actions
Class DBLayer
Public shared function Query(byval SQL as string) as dataTable

[code]....

... same goes for all other table objects... If I have 20 database tables i have to write getdata method in all 20 class changing only the tablename so i would like to get ride of it. So in order to get ride of it what do i need to do?

View 1 Replies

VS 2005 Using A Common Base Class For Form And Usercontrol

Aug 10, 2009

I happen to have these common procedures which I want to be used in my forms and usercontrols, with the form I can put those procedures in the base form which is being inherited but I happen to have a need to use those same procedures in my usercontrols, is there a way that I can have a common base class that I can use both for my form and usercontrol? I haven't used yet a base usercontrol since my usercontrols will not look the same so I have to put those procedures in each one of them and I find it rather cumbersome.

View 8 Replies

Moving From VB6 And Custom Class?

Feb 13, 2010

I have some questions regarding the dispose method as per custom classes.I imported a class using the upgrade tool and got introduced to the finalize method and this line of code within:

MyBase.Finalize()From what I have read this method is the class destructor and I should not be using it. Instead I should implement the IDisposable interface.

[Code]...

View 2 Replies

Calling Method From App_Code?

Mar 26, 2012

I have method that exisit in APP_CODE class and I want to call it from Class Library what is the best way to do that?

View 1 Replies

VS2008/VB: Moving Subclass VB Code To Inherited Base Class - Where Should Variables/objects Be Declared

Jun 3, 2009

In re-engineering a windows forms application, I find that a lot of code-behind in the various form classes is duplicative and I'm trying to centralize as many procedures as possible into a base class which can be inherited and used by the subclassed forms.

This process seems to be going well and is making the code in my subclasses much simpler and hopefully easier to maintain, but I'm not sure where to draw the line between leaving code in the subclasses and engineering for generic resusability and moving it to the base class.

Specifically, in some subclasses I have code which manipulates variables and objects specific to the subclass, and although I could move the code-behind into the base class, the base class code references specific objects which are needed to compile. For example, each subclass manipulates a databound datagridview and form detail controls which allows the user to select between multi-record and detailed single-record views of a datatable.

In Visual Basic 2008 do I need to declare dummy data objects in the base class so that the base class will compile? Or is there a way to indicate that the data objects will be provided by the subclass?

View 13 Replies

Asp.net - Add Two Language Code Files I.e. C# To App_Code?

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

Set Head Tags In A Function In App_code?

Mar 11, 2010

The below function has to be put within my common functions file in app_code folder. how do I do it?It gives error like this:Reference to a non-shared member requires an object reference

Public Sub setHeadTags(ByVal title As String, ByVal description As String, ByVal keywords As String)
Dim metaDescription As HtmlMeta = DirectCast(Page.Master.FindControl("metaDescription"),

[code].....

View 2 Replies

C# - ASP.NET's App_Code Folder And Shared/Static Classes?

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

System.ArgumentException In Mscorlib Upon Editing In App_Code?

Jul 14, 2011

I am not sure if this is how things are supposed to be, but during development, I might like to change a line of code in a nice little helper class.This throws numerousA first chance exception of type 'System.ArgumentException' occurred in mscorlib.dllThe site restarts and I have to navigate back to where I was to see if the change worked.It is massively time consuming, and I hope there must be some option to prevent this. Is there?

View 2 Replies

Can Sub Routines Be Placed Into Classes For Later Use

Feb 6, 2011

I have a slew of sub routines that I need to use in my software because each website that I will be accessing don't all use the same methods.....go here...click that...go here...click that...etc etc

So I've divided them into sub routines and call them when I need them but the coding is getting so long that it's becoming confusing to keep up with each sub.

Is it possible to place the sub routines into an independent file like a class and then call them from the file when I need them so I can free up some space to code?

View 1 Replies

Routines With The Same Name But Different Arguments

Oct 15, 2010

I am listing the following three subrointines....

Private Sub OutPut(ByVal Offset As Long, ByRef path As String) 'Orig
If Not cbFiles.Checked Then
item1 = New ListViewItem(Offset)

[Code]....

They have the same name but a) different types of aguments or different numbers of arguments. This is legal in VB.

View 1 Replies

Asp.net - Updating A Div Section On A Content Page From An Event Handler Within App_code?

Nov 3, 2009

My current problem, as stated in the title, is that I am trying to create a series of buttons from a custom class within app_code and place them on a master page. The whole reason for this is I do not want to have to copy and paste event handlers on the content pages.

However, upon the click of these buttons I need for a method on the content page to be called and update html within a div of the content page.Is there any way to accomplish updating the div of the content page from an event handler in the custom class? Remember, the method that updates the div exists on the content page.

View 2 Replies

Detrmine The Time Taken For Various Routines?

May 3, 2010

VB 2010 express Win XP pro I'm tryimg to detrmine the time taken for various routines, and not having much luck.From what I can gather, it seems that short times and very long times are a problem, as is my understanding of what I have read. cpu speed shown is correct.I checked a few routines, very short routines return 0, to be expected, ?resolution.Longish times (about 33 seconds with a stopwatch), report to be 177 seconds.

[Code]...

View 9 Replies

Link Routines To Combo Box Selectedindex

Jun 11, 2009

I'm trying to have it so that when the user selects an item from the combo box, it will display the right nodes for that selection in the treeview control. For example: User selects Artist from the combo box and the treeview displays the letter of the artist. The user selects a letter and it will display all artist with last names beginning with that letter. Unfortunately when I select a selectedindex, the treeview doesn't display anyting, it's blank. What am I doing wrong? Here's the code I'm using for artists:

[Code]...

View 1 Replies

C# - Way To Implement Caliburn-like Co-routines In Since There's No Yield Keyword?

Mar 26, 2010

Note that I'm aware of other yield in vb.net questions here on SO. I'm playing around with Caliburn lately. Bunch of great stuff there, including co-routines implementation.

Most of the work I'm doing is C# based, but now I'm also creating an architecture guideline for a VB.NET only shop, based on Rob's small MVVM framework.Everything looks very well except using co-routines from VB. Since VB 10 is used, we can try something like Bill McCarthy's suggestion:

[Code]...

It definitely isn't as elegant as C# version, but it looks to be doable. We'll see if there are any problems with this. If anyone has better idea, I'm all ears.

View 1 Replies

Call Fortran Routines (LAPACK) From Program?

Jan 27, 2009

I have LaPack numerical package , I want to compile with Visual Fortran (INTEL) using vs2008.I want to use the routines from a VB.NET program.How can I call the routines from VB ?

View 9 Replies

Threading - Baton Object That Routines Can Pass Around?

Feb 20, 2011

This will no doubt sound like a pretty dumb question to some, but, despite having written many useful single-thread apps over the years, I don't understand enough about threading yet.

Consider this scenario:

There are four modules, each on its own thread, that can happily run concurrently most of the time. However, each module occasionally causes a few seconds' intensive disk activity (by design) and it would be more efficient (faster, less fragmentation) if only one module at a time wrote to the same physical drive.

It would be useful to have something like a baton that modules within a given scope can pass around, perhaps dependent on their respective priority levels.

View 2 Replies

Using PInvoke To Access Some Routines From A Third Party Library?

Sep 9, 2009

I'm using PInvoke to access some routines from a third party library, however i'm getting SEHExceptions when trying to use callbacks defined for one particular method. The callbacks are used to provide feedback from other unmanaged methods within the third party library, passing a string back to the calling application containing a status message.

[Code]...

View 18 Replies

Write XML Document To Group Information From Two Different Sub Routines

Jan 19, 2012

I am trying to retrieve all processes running on a machine with the usual information; process id, name and the memory usage. I am trying to export it all under one xml file, however to get all the information I had to use 2 separate methods. To get the process id, name and session id (process owner) I used the following code along with a dictionary and a class, using a .net library called Cassia.

Using server As ITerminalServer = manager.GetRemoteServer("Spartacus")
server.Open()
For Each process As ITerminalServicesProcess In server.GetProcesses()
If Not String.IsNullOrEmpty(process.ProcessId) Then
dictprocess.Add(process.ProcessId, New Processes(process.ProcessId, process.ProcessName, process.SessionId))
[Code] .....

As you can see the unique id (process id) is the same in each xml. Is there any way I can write the xml so that the information from both methods can be under one tag?

View 1 Replies

Forms :: .net Windows App To Perform Routines At Regular Intervals?

Jul 11, 2010

i have a need for my vb.net app to perform methods at regular intervals. it needs to check sql tables and react to data found, send email and sms messages. i've tried using a loop but this only allows me to perform 1 check ie checking sql tables. the app needs to execute a method every x minutes. i tried using system threading but i got errors.

View 1 Replies

How To Hook Up Keypress Events For Cut / Copy And Paste Routines

Nov 5, 2009

I have a Windows Forms app, with a TabControl. On the first tab (which is a bunch of textboxes), the CTRL-x/c/v keyboard shortcuts for cut/copy/paste work as expected. On the second tab (which is a DataGridView), the keyboard shortcuts don't do anything. How do I hook up these keypress events to my cut/copy/paste routines? I already have great cut/copy/paste routines for my DataGridView--and they work fine when launched from the tooltip buttons or menus. I just need to hook up those subs to the CTRL-x/c/v keypress events.

View 2 Replies

VS 2008 - Annotating Functions / Sub Routines / Methods And Properties

Mar 25, 2010

Is there a way to annotate functions, subs, properties, and methods so that tool tips will pop-up in the IDE as they're being defined or selected?

View 2 Replies

VS 2010 : Multithreading And Accessing Other Routines/form Properties?

Mar 1, 2011

I'm writing a really simple file updater which downloads files off from a website and saves them. The download routine is working well, except that it freezes the project while attempting to connect to the host. Easily solved with threading except now when I try to access other form items such as text boxes, labels, form caption, it says I am not doing it in a safe manner and prompts an interrupt in debug. I did some reading on it and I'm still not sure what to do, I'm very new to vbnet and it is still a little confusing to me.

Error: Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.
Imports System.Threading
Imports System.Net
Imports System.IO

[code]....

View 8 Replies

Strings.format Command Fails In DataGridview Handler Routines?

Mar 7, 2011

The VB format(object,formatString) command fails when placed in the handler routines of a DataGridView.In the following procedure the newCellValue returns the Format string value instead of a formatted cell value.This pproblem occurs in both the dgv_CellFormatting and the dgv_CellClick routines.The same commands work properly when placed in a procedure on the form.

Private Sub dgv_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgv.CellFormatting
If e.FormattingApplied = False And Not e.CellStyle.Format = Nothing Then[code]...........

View 2 Replies

Making Moving Percentages Into A Moving Graph?

Oct 5, 2008

I have this:

Private m_PerformanceCounter As New _
System.Diagnostics.PerformanceCounter( _
"Processor", "% Processor Time", "_Total")

[code]......

View 4 Replies







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