Basically, I am displaying a time table of booked rooms. I have 25 RickTextBox's on my form and I set up this loop to get the data from a database for the bookings:
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=F:\Project\database.mdb;")
cn.Open()
' Looping for two weeks in advance
For x = 0 To 13
cmd = New OleDbCommand("SELECT bs1.teacher, bs1.date, bs1.period FROM(" & cbRoom.Text.ToLower & ") WHERE(((bs1.date) = #" & current & "#)) ORDER BY bs1.period;", cn)
dr = cmd.ExecuteReader
While dr.Read()
End While
dr.Close()
cn.Close()
current = current.AddDays(1)
Next
It gets the data like it should, but I'm confused as to how I can put it into the RichTextBox's without using 30 odd IF statements.
Basically, it pulls data for Monday, then tuesday, then thursday, like that for 14 days. The text boxes are named "mon1", "mon2", "mon3"... "tues1", "tues2" etc... and I need to somehow get the data into all of them without having really poor and sloppy code.
Any help would be very much appreciated, thanks.