Question:
I need some visual basic programming help. Please read the dets.Thanks!?
sassy
2007-06-05 07:04:38 UTC
I am a beginner in VB. I need to know how to code the following task.

When my program loads, it should only display the dates a week from now. My code for that is this:
TextBox1.Text = DateTime.Now.ToShortDateString

TextBox2.Text = DateTime.Now.AddDays(1).ToShortDateString()

TextBox3.Text = DateTime.Now.AddDays(2).ToShortDateString()

But this only displays the dates in a textbox. I need to display them in a drop-down list or a radio button list.
But I have no idea how to change this code! Please help if you know how!! I have to get this out asap!! Thanks a million...
Three answers:
rod
2007-06-05 07:47:05 UTC
Try this:

Create a counter (XX) and a loop



DropDownList1.AddItem ( DateTime.Now .ToShortDateString)



Dim XX as Integer

For XX = 1 to 7

DropDownList1.AddItem (DateTime.Now. AddDays(XX).ToShortDateString)

Next
mariko
2016-05-17 11:38:32 UTC
Visual basic is a great first language because it is very forgiving as far as programming languages go. In about an hour you can be up and creating simple calculation programs using VB. There are many great tutorials on the web that can help you get started. Just make sure you know which version of VB you are using. The older VB6 is much simpler than the newer VB.NET 2005. There really arent any languages to learn before VB because it is so simple. However, it can be a very powerful language. Good luck.
thor78
2007-06-05 07:14:31 UTC
Do this:



Assuming your dropdown list is named, DropDownList1:

DropDownList1.Text = DateTime.Now.ToShortDateString



Assuming your radio buttons are named RadioButton1, 2, 3, etc.:

RadioButton1.Text = DateTime.Now.ToShortDateString


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...