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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manikavelu VelayuthamRank #413 · 6K reputationPosted Nov 10, 2010, 7:32 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 10, 2010, 7:56 PM EST
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);
}
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Nov 10, 2010, 9:08 PM EST
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
Sam HobbsRank #107 · 20.5K reputationPosted Nov 10, 2010, 9:25 PM EST
Have you looked at the Date and Time Picker Control? I think it can be used to do what you need.
Madhu KRank #1,514 · 1.1K reputationPosted Nov 10, 2010, 9:26 PM EST
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Nov 10, 2010, 9:50 PM EST
Madhu KRank #1,514 · 1.1K reputationPosted Nov 11, 2010, 2:43 AM EST
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);
}
}