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. Datagridviewcolumn & Custom Property

Datagridviewcolumn & Custom Property

Scheduled Pinned Locked Moved C#
csharp
1 Posts 1 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.
  • J Offline
    J Offline
    jeyapandian
    wrote on last edited by
    #1

    Hi all, can anyone tell me why my(Test) custom property is value can not be stored. Its always null.Its displaying in property window and getting user input. Thanks in advance.. using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; using System.ComponentModel; namespace EMS.NET { [ToolboxItem(false)] public class JTextBoxColumn : System.Windows.Forms.DataGridViewColumn { public JTextBoxColumn(): base(new JTextBoxCell()) { } private String mTest; [TypeConverter(typeof(StringConverter))] [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public String Test { get { return mTest; } set { mTest = value; } } public override DataGridViewCell CellTemplate { get { return base.CellTemplate; } set { if (value != null && !value.GetType().IsAssignableFrom(typeof(JTextBoxCell))) { throw new InvalidCastException("Must be a Text Box Cell"); } base.CellTemplate = value; } } } [ToolboxItem(false)] public class JTextBoxCell : DataGridViewTextBoxCell { public JTextBoxCell() : base() { } private String mTest; public String Test { get { return mTest; } set { mTest = value; } } public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle) { base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle); JTextBoxEditingControl ctl = DataGridView.EditingControl as JTextBoxEditingControl; ctl.Dock = DockStyle.Fill; if (this.Value == null || this.Value.ToString() == System.DBNull.Value.ToString()) ctl.Text = "Null"; else ctl.Text = this.Value.ToString(); } public override Type EditType { get { // Return the type of the editing contol that CalendarCell uses. return typeof(JTextBoxEditingControl); } } public override string T

    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