My windows form project displays a table using the TableAdapter with the following Columns: Name, Location, Start Time, Category. The Start Time column corresponds to a DateTime field in the MS Visual Studio 2010 Dataset. It is redundant in the table to display MM/DD/YYYY HH:MM:SS AM/PM when the label above the table displays "Events for MM/DD/YYY". How can I display just the Time in the Table? The table automatically populates with the information and there is no way for me to say date.ToShortTimeString() before the info enters the table.
1284 次
1 に答える
3
列のフォーマットを に設定しますt
。
具体的な手順については、グリッド コントロール (または使用しているもの) のドキュメントを参照してください。
EDIT : .Net の組み込み DataGridView では、列のDefaultCellStyle.Format
プロパティを に設定できます"t"
。
詳細については、標準の日付と時刻の書式文字列を参照してください。
于 2010-12-12T20:12:56.533 に答える