Guys, I need again your help. I have to generate automatically a unique schedule for each subjects with only one click of a button. I'm having trouble with it. Please suggest....here's my codes:

Do Until conflict = False
                    For y As Integer = 0 To DataGridClass.RowCount - 1
                        If txtbxClassID.Text <> DataGridClass.Rows(y).Cells(ClassID).Value And txtbxSection.Text = DataGridClass.Rows(y).Cells(SectionEnrolled).Value And txtbxDay.Text = DataGridClass.Rows(y).Cells(Day).Value And (timestart >= DataGridClass.Rows(y).Cells(TimeStart).Value And timestart <= DataGridClass.Rows(y).Cells(TimeEnd).Value) Then
                            conflict = True
                            Exit For
                        End If
                        conflict = False
                        y = y + 1
                    Next
                    If conflict = True Then
                        txtbxDay.Text = day(GetRandom(0, 5))
                        timestart = timestart1(GetRandom(0, 15))
                        timeend = timestart + 2
                        txtbxTimeStart.Text = timestart
                        txtbxTimeEnd.Text = timeend
                    End If
                Loop

Please help. I need your suggestions ASAP. Thanks so much.

can you please your required unique schedule format .?

i do not necessarily mean UNIQUE literally but in a way that there should not be conflicts between them. Here's what i wanted to generate from.

Day- MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY
TimeStart and TimeEnd- 7.0, 7.3, 8.0, 8.3, 9.0 and so on...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.