Home > Net >  Don't always DataGridView decimal point shows that with the background
Don't always DataGridView decimal point shows that with the background

Time:05-16


Foreground and background show is that the data is not always what's the problem?

CodePudding user response:

Value is formatted,
If accurate to multiple small digits, need to use the Format to Format,

CodePudding user response:

reference 1st floor morliz son hin reply:
value is formatted,
If accurate to multiple small digits, need to use the Format to Format,

 
DataGridViewColumn dc new DataGridViewColumn ();

Dc. DataPropertyName=reader [r]. "the TableColumn" ToString ();
Dc. Visible=true;
Dc. Name="T" + reader [r]. "the TableColumn" ToString ();
Dc. The HeaderText=reader [r]. "ColumnName" ToString ();
Dc. Width=reader [r]. "ColumnSize GetHashCode ();
DataGridViewCell dgvcell=new DataGridViewTextBoxCell ();
If (reader) [r]. "ControlsType" ToString ()=="Numbers")
{
Dgvcell. Style. The Format="# # # # #";
}
Dc. CellTemplate=dgvcell;
Dv. Columns. The Add (dc);

Baidu once set up, but no effect

CodePudding user response:

No further,
Three options can be considered:
1, deal with data source directly, have a look at the data source the value, can produce how many bits, deal with the format in it,
2, in DAL layer, SQL scripts or stored procedure, query the time of processing the it produces the value of the
3, the above two aspects, can not work very well, then use dgvCell. Style appearance,
  •  Tags:  
  • C#
  • Related