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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. active form name problems..

active form name problems..

Scheduled Pinned Locked Moved C#
helpsql-server
4 Posts 3 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.
  • D Offline
    D Offline
    da vinci coder
    wrote on last edited by
    #1

    ok my problem is.. when i enter this code inside the load event it returns the name of the form opened before this form.. private void editForm_Load(object sender, System.EventArgs e) { MessageBox.Show(ActiveForm.Name.ToString()); } which returns AdminPanel ( which is the previous form ) but what i want is to see editForm ( which is the form i'm currently opening ) i know its because the form is loading and thats why the currently activeform is AdminPanel but i need to see editForm because: i have a listbox which gets data from mssql and puts the data to listbox, and someforms of i use are inherited from editForm so while this editForm is loading i want to fetch the data from the unique table so i can see the datas in the listbox after the form is loaded so my code should be something like this.. private void editForm_Load(object sender, System.EventArgs e) { Classes.editClass eC = new HalkDanisv03.Classes.editClass(); // create new object if(ActiveForm.Name.ToString() == "editEmployee") { eC.getStaffUsername(xList,"employeeinfo"); // employeeinfo is the name of the tablename } else if(ActiveForm.Name.ToString() == "editManager") { eC.getStaffUsername(xList,"managerinfo"); //managerinfo is the name of the tablename } } any help would be great.. thx guys.. good coding

    T D 2 Replies Last reply
    0
    • D da vinci coder

      ok my problem is.. when i enter this code inside the load event it returns the name of the form opened before this form.. private void editForm_Load(object sender, System.EventArgs e) { MessageBox.Show(ActiveForm.Name.ToString()); } which returns AdminPanel ( which is the previous form ) but what i want is to see editForm ( which is the form i'm currently opening ) i know its because the form is loading and thats why the currently activeform is AdminPanel but i need to see editForm because: i have a listbox which gets data from mssql and puts the data to listbox, and someforms of i use are inherited from editForm so while this editForm is loading i want to fetch the data from the unique table so i can see the datas in the listbox after the form is loaded so my code should be something like this.. private void editForm_Load(object sender, System.EventArgs e) { Classes.editClass eC = new HalkDanisv03.Classes.editClass(); // create new object if(ActiveForm.Name.ToString() == "editEmployee") { eC.getStaffUsername(xList,"employeeinfo"); // employeeinfo is the name of the tablename } else if(ActiveForm.Name.ToString() == "editManager") { eC.getStaffUsername(xList,"managerinfo"); //managerinfo is the name of the tablename } } any help would be great.. thx guys.. good coding

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      Would this.Name not work?

      The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

      D 1 Reply Last reply
      0
      • T turbochimp

        Would this.Name not work?

        The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

        D Offline
        D Offline
        da vinci coder
        wrote on last edited by
        #3

        it works :) thx so much :)

        1 Reply Last reply
        0
        • D da vinci coder

          ok my problem is.. when i enter this code inside the load event it returns the name of the form opened before this form.. private void editForm_Load(object sender, System.EventArgs e) { MessageBox.Show(ActiveForm.Name.ToString()); } which returns AdminPanel ( which is the previous form ) but what i want is to see editForm ( which is the form i'm currently opening ) i know its because the form is loading and thats why the currently activeform is AdminPanel but i need to see editForm because: i have a listbox which gets data from mssql and puts the data to listbox, and someforms of i use are inherited from editForm so while this editForm is loading i want to fetch the data from the unique table so i can see the datas in the listbox after the form is loaded so my code should be something like this.. private void editForm_Load(object sender, System.EventArgs e) { Classes.editClass eC = new HalkDanisv03.Classes.editClass(); // create new object if(ActiveForm.Name.ToString() == "editEmployee") { eC.getStaffUsername(xList,"employeeinfo"); // employeeinfo is the name of the tablename } else if(ActiveForm.Name.ToString() == "editManager") { eC.getStaffUsername(xList,"managerinfo"); //managerinfo is the name of the tablename } } any help would be great.. thx guys.. good coding

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          FYI, your form isn't "active" until AFTER the Load event completes. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          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