You can find all the elements in a schedule using a FilteredElementCollector(document, scheduleview.Id).
Delete a row from the schedule in a temporary transaction and compare the elements before and after to determine the Elements on a row in the schedule.
public void CountScheduleEntriesOnRow()
{
StringBuilder sb = new StringBuilder();
Document doc = this.ActiveUIDocument.Document;
ViewSchedule view = doc.ActiveView as ViewSchedule;
if (view==null) return;
TableData table = view.GetTableData();
TableSectionData section = table.GetSectionData(SectionType.Body);
List<ElementId> elems = new FilteredElementCollector(doc,view.Id)
.ToElementIds()
.ToList();
List<Element> ElementsOnRow = new List<Element>();
List<ElementId> Remaining = null;
int RowToAnalyse = 2;
using(Transaction t = new Transaction(doc,"dummy"))
{
t.Start();
using (SubTransaction st = new SubTransaction(doc))
{
st.Start();
section.RemoveRow(RowToAnalyse);
st.Commit();
}
Remaining = new FilteredElementCollector(doc,view.Id)
.ToElementIds()
.ToList();
t.RollBack();
}
foreach(ElementId id in elems)
{
if(Remaining.Contains(id)) continue;
ElementsOnRow.Add(doc.GetElement(id));
}
sb.AppendLine(string.Format("{0} elements on row {1}",ElementsOnRow.Count,RowToAnalyse));
foreach(Element e in ElementsOnRow)
{
sb.AppendLine(string.Format("<{0}> {1} {2}",e.Id,e.Name, e.GetType()));
}
TaskDialog.Show("debug",sb.ToString());
}