473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Adding column widths

I am trying to set the width of the grid to the total widths of the column

I have been trying to add columns by doing thi
..Columns(2).Width + .Columns(2).Widt
But I get this message
Operator '+' is not defined for types 'System.Web.UI.WebControls.Unit' and 'System.Web.UI.WebControls.Unit'

If I try and convert the Columns widths by doing this Convert.ToInt32(.Columns(1).Width) and then addin ghtem all up I get an error
Specified cast is not valid

..Width = Unit.Pixel(Convert.ToInt32(.Columns(1).Width) + Convert.ToInt32(.Columns(2).Width) + Convert.ToInt32(.Columns(3).Width) + Convert.ToInt32(.Columns(4).Width)

Does anyone have any sugesstions

Thank

Nov 20 '05 #1
1 1196
* "=?Utf-8?B?SmVmZg==?=" <an*******@discussions.microsoft.com> scripsit:
I am trying to set the width of the grid to the total widths of the columns

I have been trying to add columns by doing this
.Columns(2).Width + .Columns(2).Width
But I get this message:
Operator '+' is not defined for types 'System.Web.UI.WebControls.Unit' and 'System.Web.UI.WebControls.Unit'.

If I try and convert the Columns widths by doing this Convert.ToInt32(.Columns(1).Width) and then addin ghtem all up I get an error:
Specified cast is not valid.

.Width = Unit.Pixel(Convert.ToInt32(.Columns(1).Width) + Convert.ToInt32(.Columns(2).Width) + Convert.ToInt32(.Columns(3).Width) + Convert.ToInt32(.Columns(4).Width))


Use 'Width.Value' instead of 'Width'.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steve Sabljak | last post by:
I seem to having a little trouble getting a table to display correctly in both msie and firefox. I want to set the table and column widths in pixels, and have some cell padding too. The table...
3
by: A Clark | last post by:
I have a subform that displays a datasheet. There are a couple of different queries that can be displayed in the datasheet. The queries are available in a combo box on the main form. The problem...
5
by: nimdez | last post by:
Hi, I am working on an existing code base in which a lot of data displayed to the user is formatted in tables. Most tables are printed row-by-row using printf() with "%s" print conversion...
2
by: Richard Markus | last post by:
How can I detect in code when a user has resized a column in a listview control? Thanks for the help! Richard
18
by: chimalus | last post by:
I am using a table with no column widths specified, letting the table layout manager do its thing for figuring out the column widths, and this works just fine. Now I want to make the table...
5
by: Steve Bugden | last post by:
Hi, I would like to set the column widths in the ASP.NET GridView control at runtime I have tried the following: http://msdn2.microsoft.com/en-us/library/ms178296.aspx Which uses the...
4
by: Chuck | last post by:
I'm setting the column with for a gridview (25+- columns) and have paging turned on. When the gridview is first displayed, the column widths are all set to the default. But after paging to...
4
by: Markus Ernst | last post by:
Hi Looking for a possibility to get separate tables rendered with common column widths, I was surprised to see that this code validates: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"...
2
by: Midsomer | last post by:
Hi. I have an Access database with a form containing 4 datasheets and I allow the user to change column widths. On closing the form, a routine is fired that saves each column width to an INI file....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.