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

Datagrid TableStyle Not working


Hi,

This is driving me crazy. Once the TableStyle is added (last line) the datagrid comes up blank. If I comment it out, the data grid shows the column names from the dataset. I must be doing something out of sequence

Thanks in advance for help provided

To

-------
Dim dsComputerFileDetails As New DataSet(

Dim dtFileDetails As New DataTable(
dtFileDetails.TableName = "dtFileDetails
dtFileDetails.Columns.Add("Name", Type.GetType("System.String")
dsComputerFileDetails.Tables.Add(dtFileDetails

Dim dgComputer As New DataGrid(
dgComputer.DataSource = dsComputerFileDetail
dgComputer.DataMember = "dtFileDetails
Controls.Add(dgComputer

Dim tsFileDetails As New DataGridTableStyle(
tsFileDetails.MappingName = "dtFileDetails

Dim dgtbc As New DataGridTextBoxColumn(
dgtbc.HeaderText = "Name
tsFileDetails.GridColumnStyles.Add(dgtbc

dgComputer.TableStyles.Add(tsFileDetails)
Nov 20 '05 #1
2 1292
I think your forgot to set the MappingName of the column:
dgtbc.MappingName = "Name"

--
Greetz

Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"tomp" <an*******@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...

Hi,

This is driving me crazy. Once the TableStyle is added (last line) the datagrid comes up blank. If I comment it out, the data grid shows the
column names from the dataset. I must be doing something out of sequence.
Thanks in advance for help provided!

Tom

--------
Dim dsComputerFileDetails As New DataSet()

Dim dtFileDetails As New DataTable()
dtFileDetails.TableName = "dtFileDetails"
dtFileDetails.Columns.Add("Name", Type.GetType("System.String"))
dsComputerFileDetails.Tables.Add(dtFileDetails)

Dim dgComputer As New DataGrid()
dgComputer.DataSource = dsComputerFileDetails
dgComputer.DataMember = "dtFileDetails"
Controls.Add(dgComputer)

Dim tsFileDetails As New DataGridTableStyle()
tsFileDetails.MappingName = "dtFileDetails"

Dim dgtbc As New DataGridTextBoxColumn()
dgtbc.HeaderText = "Name"
tsFileDetails.GridColumnStyles.Add(dgtbc)

dgComputer.TableStyles.Add(tsFileDetails)

Nov 20 '05 #2

That worked... Thanks, Jan!
Nov 20 '05 #3

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

Similar topics

0
by: oscar | last post by:
i currently have a dataset with a built, code and description fields. the built field is either a 1 or 0 and i would like it to display as a checkbox in the datagrid. i can get the checkboxes to...
2
by: Angel | last post by:
The Winform datagrid I'm working is already displaying data from a datatable. How can I add columns to that datagrid? I know (or at least I think I know) how to add the tableStyle and...
2
by: Dino L. | last post by:
Hi guys I fill my datagrid like this --- komanda.CommandText ="SELECT IDKlasa AS ID, IDslova, IDbroj, Naziv, JM, Normativ FROM Klase WHERE IDslova LIKE('" + cmbIDslova.SelectedItem + "%') AND...
2
by: Hajash | last post by:
hi all, how do i set the width of a column in a datagrid.Please help.Thanks in advance. regards, hajash
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
2
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
14
by: Brett Sinclair | last post by:
Hello everybody I'm still on the learning curve here...and from what I read, I created inherited datagrid class so I could have icons, combobox...etc in the columns of my datagrid. The grid...
6
by: Ron L | last post by:
I have a dataset whose source is a SQL 2k stored procedure that I am trying to display in a datagrid. This datasource has 4 columns that I am interested in here, a text column and 3 value columns...
7
by: Earl | last post by:
Any known fixes for the wacky right-alignment bug in the WinForms datagrid (VS2003)? I've tried Ken's workaround...
4
by: Jeff | last post by:
I am stuck on trying to generate two columns headers for a datagrid on form load. I can use a datatable as the datasource and get the results I want, but I want to set different column widths and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.