.NET

Reply
Member
3 Posts
0 Kudos
Registered: ‎08-14-2012
Post 1 of 6

Alter Table Row Type with VB.NET

567 Views, 5 Replies
08-14-2012 06:47 AM

Hi there,

 

I am new to developing for AutoCAD. I am using VB.NET to create a table, as standard the first row of the table is a Title row, I want to change this to a data row.

 

Please can someone tell me how to do this?

 

Many thanks,

 

Michael

*Expert Elite*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 2 of 6

Re: Alter Table Row Type with VB.NET

08-14-2012 07:37 AM in reply to: mjsevern

Try to create table with number of rows on 2 rows more, then

delete first two rows (make sure that it was the title and header rows)

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Mentor
225 Posts
24 Kudos
Registered: ‎09-15-2011
Post 3 of 6

Re: Alter Table Row Type with VB.NET

08-14-2012 07:43 AM in reply to: mjsevern

In my code practice, I also have to remove the first title row after inserting the second data row below (the header and data rows have the same number of columns). The following code snippet will help:

 

table.InsertRows(1, table.RowHeight(0), 1)
table.DeleteRows(0, 1)

 

-Khoa

Member
3 Posts
0 Kudos
Registered: ‎08-14-2012
Post 4 of 6

Re: Alter Table Row Type with VB.NET

08-14-2012 08:30 AM in reply to: khoa.ho

Thanks for getting back to me guys, I have done what is suggested and the row is being inserted then the top one being deleted, however the top row is still a title row.

 

I have checked and when it is inserted it is a data row, but once the top one is deleted it becomes a title row.

*Expert Elite*
1,569 Posts
171 Kudos
Registered: ‎10-08-2008
Post 5 of 6

Re: Alter Table Row Type with VB.NET

08-14-2012 08:41 AM in reply to: mjsevern

Another way to set style for every rows:

 

for (int n=0 to tbl.Rows.Count-1)

{

tbl.Rows[n].Style = "Data";

}

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Member
3 Posts
0 Kudos
Registered: ‎08-14-2012
Post 6 of 6

Re: Alter Table Row Type with VB.NET

08-17-2012 01:49 AM in reply to: mjsevern

Thanks again for the help, in the end the probelm was solved when I inserted the data in to the table, the header row sorted itself out and became a data row. Not sure why but ultimately got the result I wanted.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!