|
-
Apr 24th, 2009, 04:11 PM
#1
Thread Starter
New Member
[Solved] RowSpan on a table created dynamically located inside another table
I'm writing a scheduling program that queries a MySQL database for today's appointments and uses a Table Layout Panel with employees on the top and times on the left to display the schedule. I am trying to add another table ontop of that table for each appointment and set the rowspan of that dynamic table to occupy the time slot of that appointment from start to finish.
All the appointments appear in the dynamic table and each dynamic table appears in the appropriate starting positions in the main table. When you are designing GUI's and put a Table within a table, you get a RowSpan and ColumnSpan option for that inner table. The problem I'm having is the dynamic tables are not giving me a RowSpan option, which I believe is because it was created using code and doesn't know that it's inside another table.
Here is part of the code... This code is inside loops for each appointment of each employee
sqlCustomer = MyReader.GetValue(0).ToString()
sqlCompany = MyReader.GetValue(1).ToString()
sqlProblem = MyReader.GetValue(2).ToString()
sqlStart = MyReader.GetValue(3).ToString()
sqlEnd = MyReader.GetValue(4).ToString()
'Create new label
Dim lblAppointment As New Label
lblAppointment.Name = aryEmployees(i) & sqlStart
If sqlCompany = "" Then
lblAppointment.Text = sqlCustomer
Else
lblAppointment.Text = sqlCompany
End If
'Create new table
Dim tblAppointment As New TableLayoutPanel
tblAppointment.ColumnCount = 1
tblAppointment.RowCount = 1
tblAppointment.Dock = DockStyle.Fill
tblAppointment.Controls.Add(lblAppointment, 0, 0)
'Find start and end rows
For Each Label In tblSchedule.Controls
If Label.Text = sqlStart Then
intStart = tblSchedule.GetRow(Label)
End If
If Label.Text = sqlEnd Then
intEnd = tblSchedule.GetRow(Label)
End If
Next
'Add label to schedule
tblSchedule.Controls.Add(tblAppointment, i, intStart)
'Span table to fill time slot
tblAppointment.RowSpan = intEnd - intStart
The very last line gives me an error saying that "RowSpan is not a member of 'System.Windows.Forms.TableLayoutPanel'." Is there a workaround/fix or alternate way of doing this that you can think of? I would like to avoid using Data Grids.
Last edited by Jaysen; Apr 27th, 2009 at 01:01 PM.
Reason: Problem Solved
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|