CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 11/5/2003 12:22:54 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 15 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
BobbyFive
Asp.Net User
Inheriting classes in a usercontrol + VB11/5/2003 12:22:54 AM

0/0

Is there a way to accomplish this:

I want to create a class that inherits from a usercontrol, so I can have some common functionality in a number of usercontrols. Each user control will have it's own code as well. How do I indicate the inheritance in the actual UserControl (In the aspx, and the aspx.vb). I can't get this to work. I've read about abstract classes as well, but not sure how to implement them. Does anyone know what I'm doing wrong here? Any help would be much appreciated.

example: MyUserControl.vb


Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data.SqlClient

Public Class MyUserControl : Inherits UserControl

Private _Id As Integer
Private _FromAddress, _FromName As String

ReadOnly Property MailerId() As Integer
Get
If Not Context.Session("MailerId") Is Nothing Then
_Id = Context.Session("MailerId")
End If
Return _Id
End Get
End Property

Public Property FromAddress() As String
Set(ByVal Value As String)
_FromAddress = Value
End Set
Get
Return _FromAddress
End Get
End Property

Public Property FromName() As String
Set(ByVal Value As String)
_FromName = Value
End Set
Get
Return _FromName
End Get
End Property

Public Overridable Sub RenderMe()
'Code in here
End Sub

End Class


MyUserControl.ascx

<%@ Control Language="vb" AutoEventWireup="false" Codebehind="test.ascx.vb" Inherits="LeadAuction.test" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

MyUserControl.ascx.vb

Public MustInherit Class test
Inherits System.Web.UI.UserControl

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put code in here
End Sub

Public Sub Overrides RenderMe()
'Put code in here
End Sub

End Class

russnem
Asp.Net User
Re: Inheriting classes in a usercontrol + VB11/8/2003 6:48:12 PM

0/0

What error(s) are you getting?
BobbyFive
Asp.Net User
Re: Inheriting classes in a usercontrol + VB11/8/2003 6:54:57 PM

0/0

There was an error when I tried to load VS studio and the design time page wasn't displaying for the control. I played with it and I found the problem was with my MailerId field. I had to check to see if 'If Not HttpContext is Nothing' before continuing with the rest of the code. Seems like the IDE executes that statement in design time or something. After I did that, everything seems to be OK.

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional VB 2005 Authors: Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Rama Ramachandran, Kent Sharkey, Bill Sheldon, Pages: 1066, Published: 2006
ASP.NET: Tips, Tutorials, and Code Authors: Scott Mitchell, Pages: 878, Published: 2002
Microsoft Visual Basic .NET 2003 Kick Start: Kick Start Authors: Duncan Mackenzie, Andy Baron, Erik Porter, Joel Semeniuk, Pages: 336, Published: 2003
Visual Basic 2005 Programmer's Reference Authors: Rod Stephens, Pages: 1022, Published: 2005
Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007
Beginning ASP.NET 2.0 in VB 2005: From Novice to Professional Authors: Matthew MacDonald, Pages: 1063, Published: 2006
Visual Basic .NET Power Coding Authors: Paul Kimmel, Pages: 708, Published: 2003
Visual Basic.NET Unleashed Authors: Paul Kimmel, Pages: 784, Published: 2002
Visual Basic .NET: Your Visual Blueprint for Building Versatile Programs on the .NET Framework Authors: Richard Bowman, Pages: 352, Published: 2002
.NET Windows Forms Custom Controls: Forms Custom Controls Authors: Richard Weeks, Pages: 288, Published: 2002

Web:
Inherited User Controls - Visual Basic .NET Forums Component Development Development of components with VB. ... If a control inherits a usercontrol, a private event should be accessible since ...
Inherit User Control - ASP.NET Forums Could someone please show me how to inherit a user control in VB? ... I know how to inherit classes, just not user controls. Any ideas? ...
Authoring User Controls Choose a control you do not want inheriting classes to change, and set the Modifiers property ... Walkthrough: Authoring a User Control With Visual Basic . ...
VB Migration Partner - Migrating from VB6 - Classes and ActiveX ... VB Migration Partner converts DataEnvironment classes to special VB.NET classes that inherit from the VB6DataEnvironment base class, and correctly handles ...
Abstract Classes in VB .NET Abstract classes can only specify members that should be implemented by all inheriting classes. Creating Abstract Classes. In Visual Basic . ...
Base Page and User Control Classes: ASP Alliance NET itself does not allow multiple inheritance and the page and user controls derive from different classes it is not possible to make a single class that ...
Get reference to usercontrol's parent - .NET VB classes/controls seem to have a Parent but not a user control.[/color] ' UserControl' inherits from 'Control' and thus has a 'Parent' property and a ...
Reference user control from a .vb class in the app_code directory ... <%@ Control Language="VB" AutoEventWireup="false" CodeFile="~/app_code/ usercontrols/YourUserControl.ascx.vb" Inherits="YourUserControl" %> ...
Code Behind in Web Forms and User Controls In the code behind for a user control you will inherit the UserControl class from ... Listing 1.4 - User Control Code Behind: File Name - 2001012601uc.vb ...
VB .NET Custom Controls | O'Reilly Media Having the two classes, Control and UserControl , it is very easy to develop a custom Windows control. Your custom control class inherits the UserControl ...




Search This Site:










skype clone in .net?

sql / stored procedure / return rowcount - help!?

disable printing

using the ie treeview control

onclick method with generated table

formatting double numbers

asp.net x509certificate2ui error

i have no idea how security works in .net, could someone explain me?

problem with saving imagepath

best skinning guide

postal codes database with longitude and latitude

cannot create a new asp.net application

selecting multiple files for upload with asp:fileupload tag

system.io.filenotfoundexception: ?

using js file at control building

how to encode the extended ascii characters in character name instead of numeric one?

frontpage extensions

add new user/edit user error

programmatically assigning a value to image1.width

admin signon - you do not have access to view this tab

help with dropdownlist

play sound in background how?

menu control

create custom windows identity

using class to communicate with hllapi enabled app with asp.net 2.0

please help, gurus! asp.net is doubly-encoding my characters into utf-8!

website works as localhost but not when you access it from the internet

asp.net 2.0 login control not working with the custom role and membership provider

module in module

dollar sign with other special characters in encrypted password causes problems with password recovery

 
All Times Are GMT