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. datagridtextbox column text changed event problem

datagridtextbox column text changed event problem

Scheduled Pinned Locked Moved C#
help
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.
  • S Offline
    S Offline
    Shuaib wasif khan
    wrote on last edited by
    #1

    hello sir , my problem is that my datagrid have 3 datagridtextbox columns value1 value2 total now i want to calculate total while entering data in value or value1 while using userdefine event finally realized that it works on a plain TextBox and not within a TextBox with a DataGrid. thank u.

    H J 2 Replies Last reply
    0
    • S Shuaib wasif khan

      hello sir , my problem is that my datagrid have 3 datagridtextbox columns value1 value2 total now i want to calculate total while entering data in value or value1 while using userdefine event finally realized that it works on a plain TextBox and not within a TextBox with a DataGrid. thank u.

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      Take a look at this[^], particularly the third answer down.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      S 1 Reply Last reply
      0
      • H Henry Minute

        Take a look at this[^], particularly the third answer down.

        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

        S Offline
        S Offline
        Shuaib wasif khan
        wrote on last edited by
        #3

        thanks for ur response actually i am using datagrid control my problem is not to sum data but to calculate it in other cell while editing

        1 Reply Last reply
        0
        • S Shuaib wasif khan

          hello sir , my problem is that my datagrid have 3 datagridtextbox columns value1 value2 total now i want to calculate total while entering data in value or value1 while using userdefine event finally realized that it works on a plain TextBox and not within a TextBox with a DataGrid. thank u.

          J Offline
          J Offline
          jaypatel512
          wrote on last edited by
          #4

          There is a very correct option in doing this. first create a class having three private float variable amount1, amount2, total. Now create getter setters of all of them. the class should look like this. public class Temp { //private members private float num1 = 0; private float num2 = 0; private float total; //Public members public float Num1 { get; set; } public float Num2 { get; set; } public float Total { get { return Num1 * Num2; } //Dont keep setter as Total should be read only. } } Now in your form.cs file just bind the list of this class to the datagrid you want List temps = new List(); datagridview1.DataSource = temps; Compile it... Whenever you change the value of Num1 and Num2, Total will automatically get changed.

          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