Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


ASP.Net/VB.Net - Advice for Cleaning up my code


ASP.Net/VB.Net - Advice for Cleaning up my code

Author
Message
rathurosamal
rathurosamal
Forum God
Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)Forum God (840 reputation)

Group: Forum Members
Posts: 2, Visits: 5
Can someone please give me some advice on cleaning up my code a little. I have aspx pages with code_behind .vb files.



Typical head of webpage is:

index.aspx

Code:



<%@ Page Inherits="ipod_index_process" Src="index_cb.vb" Debug="true" %>

<%@ Import Namespace="System.Xml" %>







Typical code is:

index_cb.vb

Code:



Imports System

Imports System.Data

Imports System.IO

Imports System.Xml

Imports System.Web

Imports System.Web.UI

Imports System.Web.UI.WebControls

Imports System.Web.UI.HTMLControls



Imports System.Text

Imports System.Text.RegularExpressions

Imports System.Security.Cryptography



public class ipod_index_process



inherits page Public variable declarations...... Logic code....... Call Signature (X,Y,Z) Function Signature (X,Y,Z)



Several Functions......



End Function



End Sub







Several parts of this code are common to many other pages in my site (e.g. the declarations) or need to be used throughout the site (e.g. the Function Signature). Presently they are written out again and again in each .vb page.



What I want to do is to put the 'Public declaration' in a separate file and the 'Functions Signature' and everything in it in another.



I'm an old school VB programmer and not used to using namespaces/inheritance/classes. I'm sure this requires using classes and namespaces but I've tried to get my head around it but failed.

Call center software I Led flashlight

Mobius
Mobius
Forum God
Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)Forum God (105K reputation)

Group: Forum Members
Posts: 632, Visits: 1K
Why don't you put all these functions in a public class and call them when you need them?





-Mobius

GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search