Code Red > .NET
Another table question, keep getting a fatal error with quick props...
(1/1)
Viktor:
So I create a table with this sub i sketched up:
--- Code: --- Sub CreateNewTable(ByVal LV As Windows.Forms.ListView)
Dim tr As Transaction = db.TransactionManager.StartOpenCloseTransaction
Dim myDWG As Document
myDWG = Application.DocumentManager.MdiActiveDocument
Dim bt As BlockTable = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
Dim btr As BlockTableRecord = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite)
Dim tbl As New Table
tbl.Position = New Point3d(24.125, 21.25, 0)
tbl.InsertRows(1, 0.25, LV.Items.Count + 4)
tbl.InsertColumns(1, 1, 5)
tbl.MergeCells(New TableRegion(0, 0, 0, 5))
tbl.SetColumnWidth(0, 0.732123)
tbl.SetColumnWidth(1, 0.8125)
tbl.SetColumnWidth(2, 3.505651)
tbl.SetColumnWidth(3, 1.324726)
tbl.SetColumnWidth(4, 0.625)
tbl.SetColumnWidth(5, 0.625)
tbl.SetRowHeight(0, 0.5)
tbl.SetRowHeight(1, 0.4375)
tbl.SetValue(0, 0, "BILL OF MATERIAL (X STRUCTURE)", ParseOption.ParseOptionNone)
tbl.SetValue(1, 0, "NO. REQD", ParseOption.ParseOptionNone)
tbl.SetValue(1, 1, "MARK", ParseOption.ParseOptionNone)
tbl.SetValue(1, 2, "DESCRIPTION", ParseOption.ParseOptionNone)
tbl.SetValue(1, 3, "REMARKS", ParseOption.ParseOptionNone)
tbl.SetValue(1, 4, "UNIT WT.", ParseOption.ParseOptionNone)
tbl.SetValue(1, 5, "TOTAL WT.", ParseOption.ParseOptionNone)
Dim x As Integer, y As Integer
y += 2
For Each item As Windows.Forms.ListViewItem In LV.Items
x = 0
For Each sitem In item.SubItems
tbl.SetValue(y, x, sitem.Text, ParseOption.ParseOptionNone)
x += 1
Next
y += 1
Next
tbl.MergeCells(New TableRegion(y, 3, y, 4))
tbl.MergeCells(New TableRegion(y + 1, 3, y + 1, 4))
tbl.MergeCells(New TableRegion(y + 2, 3, y + 2, 4))
tbl.SetValue(y, 3, "ESTIMATED WEIGHT", ParseOption.ParseOptionNone)
tbl.SetValue(y + 1, 3, "PLUS 5% FOR GALV.", ParseOption.ParseOptionNone)
tbl.SetValue(y + 2, 3, "TOTAL EST. WEIGHT", ParseOption.ParseOptionNone)
x = 0
y = 0
tbl.SetTextHeight(0, 0, 0.125)
For y = 1 To LV.Items.Count + 4
For x = 0 To 5
tbl.SetTextHeight(y, x, 0.09375)
Next
Next
tbl.Visible = True
btr.AppendEntity(tbl)
tr.AddNewlyCreatedDBObject(tbl, True)
ed.Regen()
tr.Commit()
tr.Dispose()
End Sub
--- End code ---
I'm using AutoCad Map 3d 2009. Table looks good until my cursor falls on it and activates quick properties window, then it does a fatal crash. It seems to be very consistent. Am I doing something wrong? Or this is one of those little buggies that were not fixed?
Thanks,
Viktor.
--- Code: ---
--- End code ---
It's Alive!:
you might try putting a Table::GenerateLayout() after creating the table
Viktor:
--- Quote from: Daniel on October 27, 2008, 10:04:58 PM ---you might try putting a Table::GenerateLayout() after creating the table
--- End quote ---
Thanks, that did not help, but I think I may have figured out what the issue is, I just have to confirm it.
Another question on tables is how do you make a table style? or is it easier to just bring one in from a template drawing?
Navigation
[0] Message Index
Go to full version