Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Out My "Unit"

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
So, I was playing around with my data grid today, trying to figure out how to set the row height so that they were always the same no matter now many rows were in there (otherwise, the header defaults to the entire height of the datagrid for some reason). so I came up with this idea: every time I tried to bind the the datagrid to the dataset, I'd assign the datagrid's height attribute to the total number of records multiplied by 5.

However, the datagrid's height property is done in Units. Units are a new type, that can't be converted directly to/from a common datatype. So what you need to do is create a Unit Converter
Dim u as New UnitConverter

This unit converter has methods (ConvertFromString, etc.) that will allow you to assign int's and strings to the unit type, and allow you to play with the height and other unit-type attributes within the code behind.

Talk later,

Jack
 
Heh, just as a side note: It turns out that to accomplish the formatting of the data grid, i didn't have to use the unit code. If you want all the rows of a datagrid to be a certain size, just set the datagrid's actual height to whatever you want the rows to be
i.e. I wanted 5px high rows, so I set the datagrid's height to 5. I also set the Header height to 5 and the Item height to 5. Without playing with the Unit converter, the datagrid kept the 5px height.

Go figure
;)

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top