473,413 Members | 1,679 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,413 software developers and data experts.

C# Data Grid Issue

I am dealing with this problem for some time now, i want to find out if there is a way to change the Column widths of DataGrid based on the the maximum size of the cell (content) for that column, or for that matter, if there is a way to programatically change the column width of Data grid populated from a select query.

With Regards
Sunny

Nov 15 '05 #1
2 1090
Here's a quick sample of how it works... you'll need to use the TableStyles
and ColulmnStyles....
Dim csDeleteCode As New DataGridTextBoxColumn

With csDeleteCode

..MappingName = AllData.Tbl_Job_Tracking.Columns(12).ColumnName

..HeaderText = "Delete Code"

..Width = 70

..NullText = ng

End With

tsMain.GridColumnStyles.Add(csDeleteCode)

dg.TableStyles.Add(tsMain)

dg.ResumeLayout()

Catch ex As Exception

Debug.Assert(False, ex.ToString)

End Try

"Sunny" <gh**********@yahoo.com> wrote in message
news:23**********************************@microsof t.com...
I am dealing with this problem for some time now, i want to find out if there is a way to change the Column widths of DataGrid based on the the
maximum size of the cell (content) for that column, or for that matter, if
there is a way to programatically change the column width of Data grid
populated from a select query.
With Regards
Sunny

Nov 15 '05 #2
Thanks a Bunch ..

With Regard
Sunny
Nov 15 '05 #3

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

Similar topics

2
by: kk | last post by:
Have 2 problems, any help is appreciated. Tab with Grids -------------- BL - fetching data from DB ( 5 secs - 10 rows) Grid Laod - 20 secs Grid Paint on tab change - 20 secs Problem: The...
2
by: Les | last post by:
Hi can anyone help me, I have just graduated and have started working for a building developer which deals with a large quantity of drawings. As you can imagine these all need documenting...
6
by: Mike Kirkpatrick | last post by:
I have this data grid which consists of 3 pick lists. The first pick list is to affect the data binding of the other two. I have figured out how to do the data binding by column. However, I do not...
1
by: Sunny | last post by:
Hi, I am using Databases in my applications, i have a table with an average of 3.5 million records, i am trying to show the search results in a DataGrid from that table, but the results take a very...
2
by: Greg | last post by:
The issue: I have a grid which has a dataset as the datasource. If a user enters data in a textbox on the grid and then clicks on the close button of the form (the red X in the upper right...
1
by: Joe Dunleavy | last post by:
Hi Guys, Hopefully some one will have come across this issue already. I have a DataGrid inside a Div where a scroll bar displays once a certain height is meet --> <div id="dvSales"...
4
by: Steve Teeples | last post by:
I have a form with two DataGridView controls. The form has linked to it an Access database with just two tables. The second table contains unique "child" data having a one-to-one relationship...
3
by: Chu | last post by:
Ok, my title may sound odd - let me explain what it means - It's easy to setup a grid to display 1 row of information per database record. Let's say this for example I have a grid display some...
0
by: pragadheesh | last post by:
I have a TAB where a data grid gets displayed. I want to access the elements of the datagrid. but i'm getting the following error. "Data cannot be read from a DataGrid which is not bound to a...
0
by: jchaturv | last post by:
All, I have a customized DataGridView where I have implemented extra functionality and bounded datasource in the same custom DataGridView (Using C# and .NET). Now, I could able to use it...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.