Click here to Skip to main content
15,885,760 members
Home / Discussions / C#
   

C#

 
AnswerRe: simple string operation Pin
leppie18-Oct-05 11:38
leppie18-Oct-05 11:38 
GeneralRe: simple string operation Pin
hasanali0020-Oct-05 2:58
hasanali0020-Oct-05 2:58 
QuestionDetect CLR Version at Compile Time Pin
Robert M Greene18-Oct-05 3:57
Robert M Greene18-Oct-05 3:57 
AnswerRe: Detect CLR Version at Compile Time Pin
Dave Kreskowiak18-Oct-05 7:53
mveDave Kreskowiak18-Oct-05 7:53 
AnswerRe: Detect CLR Version at Compile Time Pin
Tom Larsen18-Oct-05 8:08
Tom Larsen18-Oct-05 8:08 
GeneralRe: Detect CLR Version at Compile Time Pin
Robert M Greene19-Oct-05 8:12
Robert M Greene19-Oct-05 8:12 
Questionlistview question c# win application Pin
fady_sayegh18-Oct-05 2:13
fady_sayegh18-Oct-05 2:13 
QuestionDisplaying time ONLY in a datagrid control Pin
Vikram A Punathambekar18-Oct-05 2:03
Vikram A Punathambekar18-Oct-05 2:03 
I'm learning C# and am using VS.net 2003 with SQL server 2005. I have a table called Train_Schedule with a filed of type smalldatetime called Arrival_Time.

I created a typed dataset called Train (similar in structure to Train_Schedule) and bound it to my datagrid, stationGrid. In my form, I have a datetimepicker called arrivalTimePicker, which displays the time in a custom format of hh : mm tt. The MaxDate and MinDate properties are set to the current date, so the user can only select the time.

In a button click's event handler, I have the following code:

string arrivalTime = arrivalTimePicker.Value.ToShortTimeString();

//DEBUG: Remove
MessageBox.Show(arrivalTime); // Displays something like "5 : 20 PM"
//Other stuff

object[] rowData = new object[5];
rowData[0] = trainNumber;
rowData[1] = stopNumber;
rowData[2] = stationCode;
rowData[3] = arrivalTime;
rowData[4] = departureTime;

DataSet trainDataSource = (DataSet) stationGrid.DataSource;
trainDataSource.Tables[0].Rows.Add(rowData);



But the grid displays only the date, not the time. How can I display the time and not the date in the datagrid?

Thanks in advance! Smile | :)

Cheers,
Vikram.

Google talk: binarybandit

upsdude: when I looked at laurens profile, a couple of gears got stripped in my brain.
Michael Martin: Too bad she bats for the other team.
AnswerRe: Displaying time ONLY in a datagrid control Pin
Anonymous18-Oct-05 2:42
Anonymous18-Oct-05 2:42 
AnswerRe: Displaying time ONLY in a datagrid control Pin
Stan Shannon18-Oct-05 2:50
Stan Shannon18-Oct-05 2:50 
GeneralRe: Displaying time ONLY in a datagrid control Pin
Vikram A Punathambekar18-Oct-05 4:24
Vikram A Punathambekar18-Oct-05 4:24 
GeneralRe: Displaying time ONLY in a datagrid control Pin
Robert M Greene18-Oct-05 7:02
Robert M Greene18-Oct-05 7:02 
QuestionControls Leave Event - Help Pin
Craig G Fraser18-Oct-05 1:27
Craig G Fraser18-Oct-05 1:27 
AnswerRe: Controls Leave Event - Help Pin
Wjousts18-Oct-05 3:33
Wjousts18-Oct-05 3:33 
GeneralRe: Controls Leave Event - Help Pin
Craig G Fraser18-Oct-05 3:39
Craig G Fraser18-Oct-05 3:39 
GeneralRe: Controls Leave Event - Help Pin
Wjousts18-Oct-05 3:46
Wjousts18-Oct-05 3:46 
Questionencryption in c# Pin
sandy_francs18-Oct-05 1:13
sandy_francs18-Oct-05 1:13 
AnswerRe: encryption in c# Pin
Vikram A Punathambekar18-Oct-05 1:37
Vikram A Punathambekar18-Oct-05 1:37 
GeneralRe: encryption in c# Pin
sandy_francs18-Oct-05 16:14
sandy_francs18-Oct-05 16:14 
AnswerRe: encryption in c# Pin
Ryan Roberts18-Oct-05 1:41
Ryan Roberts18-Oct-05 1:41 
Questionhi all Pin
magnifique18-Oct-05 0:37
magnifique18-Oct-05 0:37 
AnswerRe: hi all Pin
Rob Philpott18-Oct-05 1:10
Rob Philpott18-Oct-05 1:10 
QuestionMerging cells Pin
servik18-Oct-05 0:32
servik18-Oct-05 0:32 
QuestionNUMERIC DataGridViewColumn Pin
Greeky18-Oct-05 0:01
Greeky18-Oct-05 0:01 
AnswerRe: NUMERIC DataGridViewColumn Pin
Robert Rohde18-Oct-05 6:00
Robert Rohde18-Oct-05 6:00 

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.