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 me plssssssssssssss

help me plssssssssssssss

Scheduled Pinned Locked Moved C#
help
2 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.
  • W Offline
    W Offline
    willsgeorge
    wrote on last edited by
    #1

    Hello i have wasted lot of time. :( 1I want to put a command button in the datagrid in one of the column. I got a piece of code from this site and i have added to my project. it is working fine except i am having a major issue. when i click on the button, i am poping a form. if i click again, the form gets popped up twice, if i click again, 3 times the form gets popped up. is it due to the events get added up every time when i click on the button. my code is like this buttonColStyle = new DataGridButtonColumn(1) buttonColStyle.HeaderText = "Browse"; buttonColStyle.MappingName = ObjDataColumn.ColumnName; buttonColStyle.CellButtonClicked += new DataGridCellButtonClickEventHandler(HandleCellButtonClick); GridTableStyle.GridColumnStyles.Add(buttonColStyle); this.DGDetails.MouseDown += new MouseEventHandler(buttonColStyle.HandleMouseDown); this.DGDetails.MouseUp += new MouseEventHandler(buttonColStyle.HandleMouseUp); wilson

    S 1 Reply Last reply
    0
    • W willsgeorge

      Hello i have wasted lot of time. :( 1I want to put a command button in the datagrid in one of the column. I got a piece of code from this site and i have added to my project. it is working fine except i am having a major issue. when i click on the button, i am poping a form. if i click again, the form gets popped up twice, if i click again, 3 times the form gets popped up. is it due to the events get added up every time when i click on the button. my code is like this buttonColStyle = new DataGridButtonColumn(1) buttonColStyle.HeaderText = "Browse"; buttonColStyle.MappingName = ObjDataColumn.ColumnName; buttonColStyle.CellButtonClicked += new DataGridCellButtonClickEventHandler(HandleCellButtonClick); GridTableStyle.GridColumnStyles.Add(buttonColStyle); this.DGDetails.MouseDown += new MouseEventHandler(buttonColStyle.HandleMouseDown); this.DGDetails.MouseUp += new MouseEventHandler(buttonColStyle.HandleMouseUp); wilson

      S Offline
      S Offline
      Sheel Gohe
      wrote on last edited by
      #2

      dear wilson you have to check the instance of the popped-up form every time you click the button. If form's instance already exist then dont make use of new keyword just use the form's "show" method. Use this method to check instance of the form (may be this could be useful) //***********Start********** private Form isFormAlreadyLoaded(Form ToBeLoadedForm) { foreach (Form LoadedForm in this.MdiChildren) { if ((LoadedForm.Name == ToBeLoadedForm.Name) && ((LoadedForm.Text.Trim ()) == ToBeLoadedForm.Text.Trim())) { return LoadedForm; } else { return ToBeLoadedForm; } } return ToBeLoadedForm; } //***********End********** regards Sheel Gohe

      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