Sir/Madam,
As like selecting date from date time picker i need to select time..send me your suggestion to make this clear...
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Madhu KPosted Nov 11, 2010, 7:43 AM
private void Popuatelistbox()
{
DateTime dTime = DateTime.Today;
for (int i = 1; i < 97; i++)
{
dTime = dTime.AddMinutes(15);
string str = dTime.ToString("h:mm tt");
listBox1.Items.Add(str);
}
}
Gomathi PalaniswamyPosted Nov 11, 2010, 2:50 AM
Madhu KPosted Nov 11, 2010, 2:26 AM
Sam HobbsPosted Nov 11, 2010, 2:25 AM
Have you looked at the Date and Time Picker Control? I think it can be used to do what you need.
Gomathi PalaniswamyPosted Nov 11, 2010, 2:08 AM
getting error when using listitem..I have used namespace but still getting some errors
Error 11 The type or namespace name 'ListItem' could not be found (are you missing a using directive or an assembly reference?)
Error 12 The best overloaded method match for 'System.Windows.Forms.ListBox.ObjectCollection.Add(object)' has some invalid argument
Madhu KPosted Nov 11, 2010, 12:56 AM
You can also go for a list box try this
private void Popuatelistbox()
{
DateTime dTime = DateTime.Today;
do
{
ListBox1.Items.Add(new ListItem(dTime.ToString("h:mm tt"), dTime.ToString("h:mm tt")));
dTime = dTime.AddMinutes(15);
} while (dTime.Day == DateTime.Today.Day);
}
Manikavelu VelayuthamPosted Nov 11, 2010, 12:32 AM