Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Cannot create instance in a partial class

Cannot create instance in a partial class

Scheduled Pinned Locked Moved Web Development
questioncsharpvisual-studiodesignhelp
11 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T TALHAKOSEN

    (in visual studio 2008, website project) I cant create instance of a partial class in a another partial class, why ???? Please look at below; test.aspx <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %> test.aspx.vb Partial Class test Inherits System.Web.UI.Page End Class profile.aspx <%@ Page Language="VB" AutoEventWireup="false" CodeFile="profile.aspx.vb" Inherits="profile" %> profile.aspx.vb Partial Class profile Inherits System.Web.UI.Page ' doesnt work Dim _test as new test End Class i couldnt understand what is the problem ?? thanks...

    thanks for everything i have...

    E Offline
    E Offline
    Estys
    wrote on last edited by
    #2

    Your question is a bit vague. Nothing happens? A (compile-time||run-time) error is thrown? What were your expectations from :

    TALHAKOSEN wrote:

    Dim _test as new test

    I'm really curious.

    T 1 Reply Last reply
    0
    • E Estys

      Your question is a bit vague. Nothing happens? A (compile-time||run-time) error is thrown? What were your expectations from :

      TALHAKOSEN wrote:

      Dim _test as new test

      I'm really curious.

      T Offline
      T Offline
      TALHAKOSEN
      wrote on last edited by
      #3

      :) i mean when i wrote Dim _test as new ... i cant reach my test class.

      thanks for everything i have...

      E 1 Reply Last reply
      0
      • T TALHAKOSEN

        :) i mean when i wrote Dim _test as new ... i cant reach my test class.

        thanks for everything i have...

        E Offline
        E Offline
        Estys
        wrote on last edited by
        #4

        That's not an answer Is this a website/web application?? FYI Partial classes are just a VS construct, a class is class.

        T 1 Reply Last reply
        0
        • E Estys

          That's not an answer Is this a website/web application?? FYI Partial classes are just a VS construct, a class is class.

          T Offline
          T Offline
          TALHAKOSEN
          wrote on last edited by
          #5

          yes, it is website application, i create it with this way in vs2008 file --> new web site

          thanks for everything i have...

          E 1 Reply Last reply
          0
          • T TALHAKOSEN

            yes, it is website application, i create it with this way in vs2008 file --> new web site

            thanks for everything i have...

            E Offline
            E Offline
            Estys
            wrote on last edited by
            #6

            Please reread my first answer and reply to my question : What did you expect to happen? What were your intentions?

            T 1 Reply Last reply
            0
            • E Estys

              Please reread my first answer and reply to my question : What did you expect to happen? What were your intentions?

              T Offline
              T Offline
              TALHAKOSEN
              wrote on last edited by
              #7

              Estys, Thanks for your attention and sorry for my poor english , i couldnt explain what i wanna say excatly. Ok, i try to explain it clearly at this time, I gave a simple sample to tell my problem before, but now i wanna give you my real project's page example. so I want to take a values of a textbox.text or name of a button which are in another page. TariheGore.aspx Imports System Imports System.Globalization Imports System.Threading Imports System.Data.SqlClient Imports System.Data Imports System.Drawing Imports System.Drawing.Color Imports System.Drawing.Font Partial Class TariheGore Inherits System.Web.UI.Page Public fp1 As TariheGoreDuzelt ' there are problem it says "type TariheGoreDuzelt is not defined" Public fp2 As TariheGoreGiris ' there are problem it says "type TariheGoreGiris is not defined" Protected WithEvents Form2 As System.Web.UI.HtmlControls.HtmlForm Public ReadOnly Property GetBtnName() As String ' i will use this in TariheGoreGiris.aspx Get Return ButtonName End Get End Property TariheGoreGiris.aspx Imports System.Data.SqlClient Imports System.Data Imports System Imports System.Globalization Imports System.Threading Partial Class TariheGoreGiris Inherits System.Web.UI.Page Public fpTariheGore As TariheGore Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm Protected WithEvents CikBtn As System.Web.UI.HtmlControls.HtmlButton Dim utl As New Utils . . . Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Thread.CurrentThread.CurrentCulture = New CultureInfo("tr-TR") if Not IsPostBack Then Try fpTariheGore = CType(Context.Handler, TariheGore) BtnName = fpTariheGore.GetBtnName i hope i could explain my problem :(

              thanks for everything i have...

              E 1 Reply Last reply
              0
              • T TALHAKOSEN

                Estys, Thanks for your attention and sorry for my poor english , i couldnt explain what i wanna say excatly. Ok, i try to explain it clearly at this time, I gave a simple sample to tell my problem before, but now i wanna give you my real project's page example. so I want to take a values of a textbox.text or name of a button which are in another page. TariheGore.aspx Imports System Imports System.Globalization Imports System.Threading Imports System.Data.SqlClient Imports System.Data Imports System.Drawing Imports System.Drawing.Color Imports System.Drawing.Font Partial Class TariheGore Inherits System.Web.UI.Page Public fp1 As TariheGoreDuzelt ' there are problem it says "type TariheGoreDuzelt is not defined" Public fp2 As TariheGoreGiris ' there are problem it says "type TariheGoreGiris is not defined" Protected WithEvents Form2 As System.Web.UI.HtmlControls.HtmlForm Public ReadOnly Property GetBtnName() As String ' i will use this in TariheGoreGiris.aspx Get Return ButtonName End Get End Property TariheGoreGiris.aspx Imports System.Data.SqlClient Imports System.Data Imports System Imports System.Globalization Imports System.Threading Partial Class TariheGoreGiris Inherits System.Web.UI.Page Public fpTariheGore As TariheGore Protected WithEvents Form1 As System.Web.UI.HtmlControls.HtmlForm Protected WithEvents CikBtn As System.Web.UI.HtmlControls.HtmlButton Dim utl As New Utils . . . Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Thread.CurrentThread.CurrentCulture = New CultureInfo("tr-TR") if Not IsPostBack Then Try fpTariheGore = CType(Context.Handler, TariheGore) BtnName = fpTariheGore.GetBtnName i hope i could explain my problem :(

                thanks for everything i have...

                E Offline
                E Offline
                Estys
                wrote on last edited by
                #8

                You are treating your website like a windows form app. Can't be done. I think you should read up on ASP.NET. Have you seen this : Creating ASP.NET Web Sites In your case the lifecycle of the Page-object is something you must know by heart.

                T 1 Reply Last reply
                0
                • E Estys

                  You are treating your website like a windows form app. Can't be done. I think you should read up on ASP.NET. Have you seen this : Creating ASP.NET Web Sites In your case the lifecycle of the Page-object is something you must know by heart.

                  T Offline
                  T Offline
                  TALHAKOSEN
                  wrote on last edited by
                  #9

                  Thanks fot giving your time,Estys...

                  thanks for everything i have...

                  E 1 Reply Last reply
                  0
                  • T TALHAKOSEN

                    Thanks fot giving your time,Estys...

                    thanks for everything i have...

                    E Offline
                    E Offline
                    Estys
                    wrote on last edited by
                    #10

                    :-O I was a bit hasty in saying it can't be done, always using sessionstate and querystrings. I found this Don't know exactly how Context behaves, but you need to do a Server.Transfer to make it function Merry Christmas an a Happy New Year

                    T 1 Reply Last reply
                    0
                    • E Estys

                      :-O I was a bit hasty in saying it can't be done, always using sessionstate and querystrings. I found this Don't know exactly how Context behaves, but you need to do a Server.Transfer to make it function Merry Christmas an a Happy New Year

                      T Offline
                      T Offline
                      TALHAKOSEN
                      wrote on last edited by
                      #11

                      Yeah i solved my problem with usin session, you are right )) Merry Christmas an a Happy New Year to you , too

                      thanks for everything i have...

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups