Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2009, 09:54 AM
Registered User
 
Join Date: Sep 2009
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default After execution the DataGrid1.Columns(0).Caption property is set to Field.Name

Hello!
What is wrong this property?
I use Adodc1 and DataGrid1.
I try to do this by code.
Code:
Set DataGrid1.DataSource = Me.Adodc1
    
Me.DataGrid1.Columns(0).Caption = "Phone"
Me.DataGrid1.Columns(0).NumberFormat = "000 00 00"
Me.DataGrid1.Columns(0).DataField = "fld1"
But it is not working. Instead the caption property is set “fld1”.
The property NumberFormat is not shown correctly too.
Please help me.
 
Old December 9th, 2009, 06:37 AM
Authorized User
 
Join Date: Oct 2007
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to debbiecoates
Default datafrid number format

I do a similar thing, but set it like this, it works fine, hope this helps



Code:
sub sSetGrid()
fmtNumber.Format = "#,##0; (#,##0)"
With Me.DataGrid_SpendProfile
.Columns(0).Visible = False
.Columns(1).Visible = False
.Columns(2).Visible = True
.Columns(2).Locked = True
.Columns(3).Visible = True
.Columns(3).width = 1000
.Columns(3).Alignment = dbgRight
Set .Columns(3).DataFormat = fmtNumber
End With
end sub so in your case you would need to use something like this fmtNumber.Format = "## ## ####" Set .Columns(3).DataFormat = fmtNumber

Last edited by debbiecoates; December 9th, 2009 at 06:42 AM..





Similar Threads
Thread Thread Starter Forum Replies Last Post
chp 01, get[property name] and set[property name] sandeepgreaternoida BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 0 May 12th, 2009 01:12 AM
Caption Field Brendan Bartley Access 2 June 2nd, 2006 07:24 AM
Alter Table and Caption Property swoozie Access 0 May 24th, 2006 12:38 PM
Control button caption and visible property chacquard Access VBA 7 September 9th, 2005 11:14 AM
How to add 2 columns in DataGrid1.DataKeyField drasko C# 0 December 6th, 2003 09:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.