Inherits option In VS .net

masteran

New member
לא תמיד...

לפי מה שהבנתי namespace מאפשר לך מעיין ירושה בין קלאסים אז אם לדוג יש לי קובץ שאני יודע שאני לא ישתמש בו יותר ואני לא רוצה שירשו ממנו אז למה אני צריך להגדיר לו namespace בכלל? נ.ב. מחקתי את הroot namespace ועכשיו זה בסדר - תודה
 

gilad g

New member
אתה לא

אבל זה לא תכנות נכון, כי יכול להיות שבעתיד כן תצטרך לפנות לקלאס הזה, או שמישהו אחר יצטרך לפנות אליו. לך תדע ..
 

masteran

New member
הקוד הרלונטי..

the name of my project is net_test so I think that why it has been add to the "Inherits" [aspx] <%@ Page Language="vb" Codebehind="Test.aspx.vb" Inherits="Net_Test.Test" AutoEventWireup="false" src="Test.aspx.vb"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <body bgColor="#122d00"> <form id="Form1" method="post" runat="server"> <asp:datagrid id="DataGrid1" runat="server" AlternatingItemStyle-BackColor="#cccccc" ItemStyle-BackColor="#ffffff" HeaderStyle-BackColor="#cccc99" Font-Size="8pt" Font-Name="Ariel" Width="100" CellSpacing="0" CellPadding="4" gridLines="Vertical" BorderColor="#000000"></asp:datagrid><asp:label id="Label1" runat="server" text="11"></asp:label><asp:button id="Button1" runat="server" Text="1111"></asp:button></form> </body> </HTML> [codeBehind] Imports System Imports System.Web Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Data Imports System.Data.OleDb Public Class Test Inherits System.Web.UI.Page Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid Protected WithEvents Button1 As System.Web.UI.WebControls.Button Protected WithEvents Label1 As System.Web.UI.WebControls.Label #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim objDataBase As New OPEN_CON.OpenConn() objDataBase.ConnectionString = "Provider=" & _ "Microsoft.Jet.OLEDB.4.0;" & _ "Data Source=C:\Inetpub\wwwroot\Net_Test\db\db1.mdb" Dim objReader As OleDbDataReader Dim SqlString As String = "Select * from Products" objReader = objDataBase.SelectSQL(SqlString) If Not objReader Is Nothing Then DataGrid1.DataSource = objReader DataGrid1.DataBind() objReader.Close() End If End Sub End Class
 

gilad g

New member
יישר לשמאל בבקשה,

וביקשתי רק את הקוד הרלוונטי - בשביל מה אני צריך לראות את כל הלכלוך של ה-designer?
 

nattygur

New member
בהגדרות של הפרויקט

מוגדר גם Namespace ברירת מחדל, והוא ...
 
למעלה