| View previous topic :: View next topic |
| Author |
Message |
oasisok Newbie
Joined: 15 Sep 2004 Posts: 7 Location: Oklahoma
|
Posted: Sep 15th, 2004 11:48 AM Post subject: DataGrid cell height in VB.NET |
|
|
I accidently posted this in the Database & Reporting for VB 4, 5, 6. :angel:
I hope this is the place to go for VB.NET questions. I created a Windows
Application using DataGrid in VB.NET. I used the example I found on this
video to bind two tables together and show it on a DataGrid:
[new user link]
My question is this: in table(1) there is a field called Description. Is
there a way to increase the height and width of the cell to show the
description? If the cell is not large enough (sometimes the description can
get a bit 'wordy') is there a way to use a scrollbar? I figured out a way to increase the width from the table(0) but not height or scrollbars. :wacko:
I do need an answer ASAP.
TIA
James :thumbs: |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
Posted: Sep 16th, 2004 01:15 AM Post subject: |
|
|
Hi oasisok,
You can set height property through DataGridTableStyle class.
[vb:1:e08b252a03]Dim ts1 As New DataGridTableStyle()
With ts1
.MappingName = "ASM"
.PreferredColumnWidth = 125
.PreferredRowHeight = 15
End With
'And column width through DataGridColumnStyle class.
Dim cs1 As DataGridColumnStyle = New DataGridTextBoxColumn()
cs1.MappingName = "Qt"
cs1.HeaderText = "blah"
cs1.Width = 55
cs1.ReadOnly = True
ts1.GridColumnStyles.Add(cs1)
grdByMonth.TableStyles.Add(ts1)[/vb:1:e08b252a03]
for a particular cell though I'm afraid you would need some other technique for instance showing a text box on cell place. However using column width and cells height properties through DataGridColumnStyle, DataGridTableStyle classes should be enough for most cases.
Hope this helps!
Thanks! _________________ Code Snippets, Tutorials, Utilities, Controls
Low cost Web Hosting
Hosting starts at as low as $4 per year!
Always follow posting guidelines
Put your VB code in [vb ] your code [ /vb] tags! |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
oasisok Newbie
Joined: 15 Sep 2004 Posts: 7 Location: Oklahoma
|
Posted: Sep 16th, 2004 11:24 AM Post subject: |
|
|
| Yup, worked great!! Thanks! =D |
|
| Back to top |
|
Avis Junior Poster

Joined: 07 Oct 2003 Posts: 510 Location: India
|
|
| Back to top |
|
ajani Newbie
Joined: 24 Jun 2006 Posts: 2
|
|
| Back to top |
|
|