Changing datagrid column sizes dynamically 
Author Message
 Changing datagrid column sizes dynamically

How can I change the size of my columns on my datagrid to fit the row
entries?  The design time settings allow me only to enter a fixed figure.
My row entries exceed the column width.

I'm using Ado.net dataset tables to bind to my grid.  This is all done
dynamically through code.

With db.objDS.Tables(0)

    For intcounter = 0 To .Rows.Count - 1

        strResult = .Rows(intcounter).Item("Screen").ToString _
& " " & .Rows(intcounter).Item("Name").ToString _& " "             &
.Rows(intcounter).Item("Type").ToString

        datgrdScreenSelection.SetDataBinding(db.objDS.Tables(0),
Nothing)

    Next

    datgrdScreenSelection.Select(0)

End With

Daniel

--
Daniel P. Jenkins III
Software Developer

www.monarchwindows.com



Sun, 25 Sep 2005 02:54:53 GMT  
 Changing datagrid column sizes dynamically
Hello Daniel,


Quote:
> How can I change the size of my columns on
> my datagrid to fit the row entries?  The design
> time settings allow me only to enter a fixed figure.

Maybe this helps:

Section "Setting Column Width":

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_v...

http://www.dotnet247.com/247reference/msgs/15/75055.aspx

http://www.devcity.net/forums/topic.asp?tid=4681

Automatical sizing:

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=5...

You can determine the size of a string by using the Graphics.MeasureString
function.

Regards,
Herfried K. Wagner



Sun, 25 Sep 2005 03:04:38 GMT  
 Changing datagrid column sizes dynamically



Quote:
> You can determine the size of a string by using the Graphics.MeasureString
> function.

thank you; that helped me finally show a tool tip when the width of a
ListBox item exceeded the width of the control ..


Sun, 25 Sep 2005 03:37:44 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Dynamically Added Datagrid Template Column - Checkbox.Checked state in Column Header

2. CheckBox.Checked property in the Header of a Dynamically created DataGrid Column

3. Dynamically set column settings for a Datagrid

4. Dynamically changing columns and formatting

5. Dynamically changing Frame size in client-side script

6. dynamically change the control size

7. How to change the order in datagrid dynamically?

8. Datagrid column sizing

9. DataGrid control doesn't want to automaticaly size columns

10. MS DataGrid Column "Auto"sizing

11. Auto-sizing DataGrid columns

12. MS DataGrid Column "Auto"sizing

 

 
Powered by phpBB® Forum Software