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. General Programming
  3. C#
  4. Help in calling form

Help in calling form

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 4 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.
  • S Offline
    S Offline
    Saiyed Alam
    wrote on last edited by
    #1

    Friends I want to do the following things in a function. Forms.frmFIR fr = new uHTMCM.Forms.frmFIR(); fr.show(); where frmFIR is the form name and uHTMCM is the namespace of the project. what I want is to send the form name and namespace name in that function(suppose the function name is frmshow(takes two parameter)) and do the above two lines in that function. Can any1 help???

    G M K 3 Replies Last reply
    0
    • S Saiyed Alam

      Friends I want to do the following things in a function. Forms.frmFIR fr = new uHTMCM.Forms.frmFIR(); fr.show(); where frmFIR is the form name and uHTMCM is the namespace of the project. what I want is to send the form name and namespace name in that function(suppose the function name is frmshow(takes two parameter)) and do the above two lines in that function. Can any1 help???

      G Offline
      G Offline
      Gareth H
      wrote on last edited by
      #2

      Saiyed Alam, You dont need to pass anything to the constructor, just add the below lines in the frmFIR, they will give you the details you want.

      Class name: System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Name;
      Namespace name: System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.Namespace;

      MSDN[^]

      Regards, Gareth. (FKA gareth111)

      1 Reply Last reply
      0
      • S Saiyed Alam

        Friends I want to do the following things in a function. Forms.frmFIR fr = new uHTMCM.Forms.frmFIR(); fr.show(); where frmFIR is the form name and uHTMCM is the namespace of the project. what I want is to send the form name and namespace name in that function(suppose the function name is frmshow(takes two parameter)) and do the above two lines in that function. Can any1 help???

        M Offline
        M Offline
        Mandaar Kulkarni
        wrote on last edited by
        #3

        a) if the form is in the same assembly of your method Assembly asm = Assembly.GetExecutingAssembly(); Form frmTemp = asm.CreateInstance(Your_Namespace + "." + Your_Form_Name); frmTemp.Show(); b) if the form to be called in from some other assembly Assembly asm = Assembly.LoadFrom(AssemblyPath); Form frmTemp = asm.CreateInstance(Your_Namespace + "." + Your_Form_Name); frmTemp.Show(); Hope this helps

        1 Reply Last reply
        0
        • S Saiyed Alam

          Friends I want to do the following things in a function. Forms.frmFIR fr = new uHTMCM.Forms.frmFIR(); fr.show(); where frmFIR is the form name and uHTMCM is the namespace of the project. what I want is to send the form name and namespace name in that function(suppose the function name is frmshow(takes two parameter)) and do the above two lines in that function. Can any1 help???

          K Offline
          K Offline
          kabirkhan
          wrote on last edited by
          #4

          u can easily solve ur problem by this way... at first create a function like: public void fnFormShow(Form fc) { fc.show(); } now, create a object and pass through with this function, like: Forms.frmFIR fr = new uHTMCM.Forms.frmFIR(); fnFormShow(fr);

          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