Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 3.5 and Visual Studio. 2008 > Visual Studio 2008
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio 2008 For discussing Visual Studio 2008. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2008 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 16th, 2010, 04:27 PM
Authorized User
Points: 97, Level: 1
Points: 97, Level: 1 Points: 97, Level: 1 Points: 97, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2010
Location: New Zealand
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default (RESOLVED) Format DataGridView Columns using script

Hi Guys,

I am was from VbNet2003 and new to VbNet2008. I am having problem trying to write script to format DataGridView columns like the way I did on VbNet2003.

Here is the sample of script that I used in VB.NET 2003. Does VB.NET 2008 works the same way ?

Code:
Private Function FFormatCustomerDataGridColumn()
    'format DataGrid Column
    Dim dgStyle As New DataGridTableStyle
    dgStyle.MappingName = "ordTbl"

    '----------------------------------------------
    'customerID
    Dim CustIDCol As New DataGridTextBoxColumn
    With CustIDCol
	.MappingName = "CustomerID"
	.HeaderText = "Customer ID"
	.Alignment = HorizontalAlignment.Center
	.Width = 100
	dgStyle.GridColumnStyles.Add(CustIDCol)
     End With

    '-------------------------------------------------
    ' Customer Name
     Dim CustNameCol As New DataGridTextBoxColumn
     With CustNameCol
	.MappingName = "CompanyName"
 	.HeaderText = "Customer Name"
	.Alignment = HorizontalAlignment.Left
	.Width = 250
	dgStyle.GridColumnStyles.Add(CustNameCol)
     End With

    ' ----------------------------------------------------
    'Add Table Style to datagrid -clear before formatting
	DataGrid1.TableStyles.Clear()
	dgStyle.ForeColor = Color.Black
	DataGrid1.TableStyles.Add(dgStyle)
	DataGrid1.ReadOnly = True
	DataGrid1.CaptionText = "Customer Listing Click on Line Item to    display Order Listing"

End Function
Please help me, I need your help.
Thank You
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie

Last edited by Lennie; March 21st, 2010 at 07:05 AM.. Reason: RESOLVED
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
DataGridView Auto Format? MLyons10 C# 2005 0 December 5th, 2006 10:26 AM
datagridview currency format rounds off cents TomH VB Databases Basics 2 September 12th, 2006 11:24 AM
Format checkbox for datagridview in code datawiz1 Visual Basic 2005 Basics 0 June 30th, 2006 03:22 PM
vb script + excel - select multiple columns mohit Excel VBA 1 January 21st, 2005 06:11 AM



All times are GMT -4. The time now is 08:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.