Click here to Skip to main content
15,898,945 members
Home / Discussions / C#
   

C#

 
AnswerRe: How To inject Process in c# ? Pin
J. Dunlap16-Feb-06 0:20
J. Dunlap16-Feb-06 0:20 
QuestionGet full SOAP message Pin
Nandiator15-Feb-06 22:10
Nandiator15-Feb-06 22:10 
AnswerRe: Get full SOAP message Pin
J4amieC15-Feb-06 22:25
J4amieC15-Feb-06 22:25 
AnswerRe: Get full SOAP message Pin
Maqsood Ahmed15-Feb-06 22:26
Maqsood Ahmed15-Feb-06 22:26 
QuestionImages Pin
albCode15-Feb-06 21:39
albCode15-Feb-06 21:39 
GeneralRe: Images Pin
Guffa15-Feb-06 22:08
Guffa15-Feb-06 22:08 
GeneralRe: Images Pin
albCode15-Feb-06 22:26
albCode15-Feb-06 22:26 
QuestionDatagridviewcolumn & Custom Property Pin
jeyapandian15-Feb-06 21:26
jeyapandian15-Feb-06 21:26 
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 ToString()
{
return "JTextBoxCell";
}

public override Type ValueType
{
get
{
// Return the type of the value that CalendarCell contains.
return typeof(String);
}
}

public override object DefaultNewRowValue
{
get
{
// Use the current date and time as the default value.
return DBNull.Value.ToString();
}
}
}
[ToolboxItem(false)]
public class JTextBoxEditingControl : TextBox, IDataGridViewEditingControl
{
private int RowIndex;
private DataGridView _DataGridView;
private bool _DataChanged;
public JTextBoxEditingControl()
{
}
public void PrepareEditingControlForEdit(bool selectAll)
{
// No preparation needs to be done.
}
public Cursor EditingPanelCursor
{
get
{
return base.Cursor;
}
}
public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
{
return EditingControlFormattedValue;
}
public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle)
{
this.Font = dataGridViewCellStyle.Font;
this.ForeColor = dataGridViewCellStyle.ForeColor;
this.BackColor = dataGridViewCellStyle.BackColor;
}
public DataGridView EditingControlDataGridView
{
get
{
return _DataGridView;
}
set
{
_DataGridView = value;
}
}
public bool EditingControlValueChanged
{
get
{
return _DataChanged;
}
set
{
_DataChanged = value;
}
}
public bool RepositionEditingControlOnValueChange
{
get
{
return false;
}
}
public bool EditingControlWantsInputKey(Keys key, bool dataGridViewWantsInputKey)
{
return true;
}
public int EditingControlRowIndex
{
get { return RowIndex; }
set { RowIndex = value; }
}
public object EditingControlFormattedValue
{
get { return this.Text.ToString(); }
set
{
String NewValue = value as string;
if (NewValue != null)
{
this.Text = NewValue;
}
}
}
protected override void OnTextChanged(EventArgs e)
{
_DataChanged = true;
this.EditingControlDataGridView.NotifyCurrentCellDirty(true);

base.OnTextChanged(e);
}
}
}


Where there is a will there is a way Big Grin | :-D
QuestionC# Video Screen Shots Pin
Wraith25615-Feb-06 21:17
Wraith25615-Feb-06 21:17 
AnswerRe: C# Video Screen Shots Pin
leppie16-Feb-06 0:12
leppie16-Feb-06 0:12 
AnswerRe: C# Video Screen Shots Pin
VanEtienne16-Feb-06 18:11
VanEtienne16-Feb-06 18:11 
QuestionGood C# Book Pin
Brendan Vogt15-Feb-06 20:53
Brendan Vogt15-Feb-06 20:53 
AnswerRe: Good C# Book Pin
knoxdotnet16-Feb-06 3:30
knoxdotnet16-Feb-06 3:30 
QuestionSee who/what program changed a file Pin
VanEtienne15-Feb-06 20:25
VanEtienne15-Feb-06 20:25 
AnswerRe: See who/what program changed a file Pin
CWIZO15-Feb-06 20:36
CWIZO15-Feb-06 20:36 
GeneralRe: See who/what program changed a file Pin
VanEtienne15-Feb-06 20:40
VanEtienne15-Feb-06 20:40 
GeneralRe: See who/what program changed a file Pin
CWIZO15-Feb-06 20:45
CWIZO15-Feb-06 20:45 
GeneralRe: See who/what program changed a file Pin
VanEtienne15-Feb-06 20:48
VanEtienne15-Feb-06 20:48 
AnswerRe: See who/what program changed a file Pin
Dave Kreskowiak16-Feb-06 10:43
mveDave Kreskowiak16-Feb-06 10:43 
GeneralRe: See who/what program changed a file Pin
VanEtienne16-Feb-06 18:08
VanEtienne16-Feb-06 18:08 
GeneralRe: See who/what program changed a file Pin
Dave Kreskowiak17-Feb-06 1:09
mveDave Kreskowiak17-Feb-06 1:09 
Questiondisabling column resizing in Data grid Pin
Sandeep TP15-Feb-06 19:34
Sandeep TP15-Feb-06 19:34 
AnswerRe: disabling column resizing in Data grid Pin
Maqsood Ahmed15-Feb-06 22:18
Maqsood Ahmed15-Feb-06 22:18 
AnswerRe: disabling column resizing in Data grid Pin
microsoc15-Feb-06 22:48
microsoc15-Feb-06 22:48 
QuestionConnecting to remote database using C# Pin
stephentanph15-Feb-06 18:46
stephentanph15-Feb-06 18:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.