Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / December 2006

Tip: Looking for answers? Try searching our database.

DataGrid from bindingSource collumn width

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lodzik - 18 Dec 2006 17:30 GMT
Hi,
I can't make this style visible. I'm new in coding but I readed every
post about that and have still problem.
My code looks like this:

DataGridTableStyle myGridStyle = new DataGridTableStyle();
myGridStyle.MappingName = "lineBindingSource";

DataGridTextBoxColumn idColumn = new DataGridTextBoxColumn();
idColumn.MappingName = "ID";
idColumn.HeaderText = "Test";
idColumn.Width = 240;
myGridStyle.GridColumnStyles.Add(idColumn);

dataGrid1.TableStyles.Add(myGridStyle);

Any idea what is wrong?
Ilya Tumanov [MS] - 18 Dec 2006 19:45 GMT
1. Wrong table mapping name - for DataTable should be table name, for pretty
much everything else should be empty string.
2. Wrong column mapping name - no column called "ID"

Signature

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactfra
mework?hl=en

2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

> Hi,
> I can't make this style visible. I'm new in coding but I readed every
[quoted text clipped - 13 lines]
>
> Any idea what is wrong?
Rüdiger Kardel - 18 Dec 2006 20:15 GMT
a

dataGrid1.TableStyles.Clear();
is missing before
dataGrid1.TableStyles.Add(myGridStyle);

Ruediger
lodzik - 18 Dec 2006 23:20 GMT
I doesn't work, ID column exist.
Rüdiger Kardel - 18 Dec 2006 23:55 GMT
is there a

dataGrid1.DataSource = aDataTableOrSth

missing?

last but not least:
if you are using a datatable as datasource: the mappingname is
casesensitive.

if it didn't work either:
show us some more code, please.

Ruediger

>I doesn't work, ID column exist.
lodzik - 19 Dec 2006 14:46 GMT
I have a variable file which is collection of objects (my own class
Line). In Form_Load event I have the following code:

    DataGridTableStyle myGridStyle = new DataGridTableStyle();
    myGridStyle.MappingName = "";

    DataGridTextBoxColumn idColumn = new DataGridTextBoxColumn();
    idColumn.MappingName = "ID";
    idColumn.HeaderText = "Test";
    idColumn.Width = 240;
    myGridStyle.GridColumnStyles.Add(idColumn);

    dataGrid1.TableStyles.Add(myGridStyle);

    lineBindingSource.DataSource = file;

I have:

   public class Line
   {

       /* some stuff */

       public int ID
       {
           get { return id; }
           set { id = value; }

       }
   }

   class File : IEnumerable
   {

       /* some stuff */

       List<Line> lines = new List<Line>();

       #region IEnumerable Members

       public IEnumerator GetEnumerator()
       {
           return lines.GetEnumerator();
       }

       #endregion
   }

DataGrid1 contains all data, but I couldn't set the column width.
JP - 27 Dec 2006 02:25 GMT
Hello,

I thinks, this operation have work with the dataset.

regards

> I have a variable file which is collection of objects (my own class
> Line). In Form_Load event I have the following code:
[quoted text clipped - 45 lines]
>
> DataGrid1 contains all data, but I couldn't set the column width.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.