Groups | Blog | Home
all groups > vj# > may 2005 >

vj# : How to format a table!


Christian-Josef Schrattenthaler
5/23/2005 12:00:00 AM
Hi!

I create a table in the VJ# part of my ASP.NET file.

Now I want to set a table row to "bold". I found the ".Font.Bold = true" in
the Dokumentation, but this doesn't work.

Please tell me how to set the Text of a row to bold.

And how can I set a user defined color?

I use ".set_BackColor( System.Drawing.Color.get_Blue() );" or anonther
predefined color, but I want a special color.

Thanks and greetings,
christian.

Lars-Inge Tønnessen [VJ# MVP]
5/24/2005 12:00:00 AM
Christian,


Did you read the example I made for you in the thread "How to create a
Directory Listing" ?
I have posted a new example that does not use Visual Studio.

You can set the text to bold in lots of ways. Here is one of them:

System.Web.UI.WebControls.TableCell Platform = new
System.Web.UI.WebControls.TableCell();
Platform.set_Text( "<B>Windows</B>" );
Platform.set_BackColor( System.Drawing.Color.get_LightBlue() );
newRow.get_Cells().Add( Platform );


[quoted text, click to view]

Please try:
System.Drawing.Color.FromArgb(23, 45, 66);

23 = red
45 = Green
66 = Blue


Like this:
..set_BackColor( System.Drawing.Color.FromArgb(23, 45, 66) );


Regards,
Lars-Inge Tønnessen

Christian-Josef Schrattenthaler
5/24/2005 12:00:00 AM
Hi Lars-Inge!

[quoted text, click to view]

Is there a way to set a complete Row to bold? What is with "Font.Bold =
true"? Why does this not work?

[quoted text, click to view]
I will try...

Thanks for your help!

Greetings,
christian.

Lars-Inge Tønnessen [VJ# MVP]
5/24/2005 12:00:00 AM
Hello again!


You are writing C# or VB.NET.
J# is Java, so it's written like this:

The complete row:

System.Web.UI.WebControls.TableRow newRow = new
System.Web.UI.WebControls.TableRow();
newRow.get_Font().set_Bold( true );



A singe cell:

System.Web.UI.WebControls.TableCell fsize = new
System.Web.UI.WebControls.TableCell();
fsize.set_Text( "" + (files[counter].get_Length() / 1024) + " Kb" );
fsize.set_BackColor( bgColor );
fsize.get_Font().set_Bold( true );
newRow.get_Cells().Add( fsize );


Regards,
Lars-Inge Tønnessen

Christian-Josef Schrattenthaler
5/25/2005 12:00:00 AM
Hi Lars-Inge!

[quoted text, click to view]

That's it!

Greetings,
AddThis Social Bookmark Button