473,657 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid TableStyle giving odd results.

Hello,

I have a datagrid which I'm populating with the result of a dataset. The
dataset only has three columns in it, and I've put together the following
code to deal with the columns. The strange thing is, I get FOUR columns
showing. I thought this was bizarre since the DS only has three columns and
the following code only deals with three columns. Any help would be great.

Thanks!
Private Sub SetTableStyle()

' Create a Grid Table Style. Map it to the "Customers" Table.

Dim aGridTableStyle As New DataGridTableSt yle

aGridTableStyle .MappingName = "SerialDeta il"

'

' Create GridColumnStyle objects for the grid columns

Dim aCol1 As New DataGridTextBox Column

Dim aCol2 As New DataGridTextBox Column

Dim aCol3 As New DataGridTextBox Column

' Hide column 1 by setting its width to 0.

With aCol1

' .MappingName = "VendorInventor yTypeID"

..MappingName = "SerialNumberID "

..Width = 0

..ReadOnly = True

End With

' Set column 2's caption, width and disable editing.

With aCol2

'.MappingName = "Descriptio n"

..MappingName = "Descriptio n"

..HeaderText = "Descriptio n"

..Width = 20

..NullText = ""

..Alignment = HorizontalAlign ment.Left

..TextBox.Enabl ed = False

End With

' Set column 3 and 4's caption, width and enable editing.

' Since these values are optional set their Null values.

With aCol3

'.MappingName = "SerialNumb er"

..MappingName = "SerialNumb er"

..HeaderText = "Serial No."

..Width = 20

..Alignment = HorizontalAlign ment.Center

..NullText = ""

..TextBox.Enabl ed = True

End With

' Add the GridColumnStyle s to the DataGrid's Column Styles collection.

' Place the "ID" column (column 1) last since it is not visible.

With aGridTableStyle .GridColumnStyl es

..Add(aCol2)

..Add(aCol3)

..Add(aCol1)

End With

' Add the GridColumnStyle s to the aGridTableStyle .

dgSerialNumbers .TableStyles.Ad d(aGridTableSty le)

End Sub
Mar 16 '06 #1
0 887

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

Similar topics

0
1564
by: Job Lot | last post by:
I have an Expense Data Entry form which contains a DataGrid showing various expense categories. There are three columns Description, Cash Exp, Credit Exp, where Description column is readonly. Users have to press a checkbox to specify whether they want to use DataGrid to provide break-up or provide total value in textbox. Now when checkbox is unchecked I am setting the Enabled property of DataGrid to False and vice versa. The problem is...
0
1054
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 show up, but they are all checked and the column has no data when i try to check that. i have seen a lot of posts about doing this, but no matter what i do i endup getting the same results. currently i have this: DataGridTableStyle...
2
2496
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 the OID of Person), the information of the person matching the selected OID is shown in the Textboxes (Name, Address, id, etc) and the courses this person is taken are shown in a DataGrid (course name, price, etc.). This is working well so far, I...
2
6397
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
1830
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 will be used to populate information coming from a Webservice. (No datasets - No datareaders). So, I do not know see how to use the "datasource".
2
2681
by: Ron L | last post by:
I am attempting to set up a datagrid that will 1) display a subset of data from a SQL Stored Procedure in a different order form how SQL returns it, and 2) display 3 of the columns using pulldowns. I have gotten code for both from the www.syncfusion.com site, but am having trouble making them work. Below is the relevant code: ' Setup the permissions grid ' Fill the dataset of permissions Dim dt As DataTable = dsUserData.Tables(0)
7
2029
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 (http://www.windowsformsdatagridhelp.com/default.aspx?ID=4bfab32d-9cff-4f5c-ba95-49bb9074a8bc), but I get no alignment at all when calling the class. George Shephard's site, while imminently useful, does not have an anwer for this issue.
2
1167
by: Michael Kellogg | last post by:
I have a collection of objects that I am trying to display in a Windows Forms Datagrid. I have had problems doing this before, so the first time around I went and did a Grid.TableStyles.Clear before naming my collection as the DataSource. In this scenario, the collection's members come up perfect in the datagrid, but I have no control over the look of it. So I added a TableStyle and a GridColumnStyle object in the designer, giving the...
2
1364
by: Dennis T. Holm | last post by:
HEy Im having problems with setting the width of my columns of my datagrid. Here's the code resultatGrid.DataSource = getFirms(0) // gets metaData from database Dim tableStyle As New DataGridTableStyle tableStyle.PreferredColumnWidth = 100
4
1903
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 don't see a way to do this through the datagrid properties. I am not using a database connection, I just want to set column headers on the datagrid. I am somewhat new to vb.net. Here is the code I am using. This code works when the...
0
8385
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8723
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.