I'm using the code below to change the grid format of a
date fields to use "MMM dd, yyyy" and use a currency
format for the second column but it totaly ignores it.
I've used this method before when using a SQL database and
SQLDataAdapter and it has worked fine. However, the other
thing is different here is that I'm using the
OleDBDataAdapter. Is there some reason that would make a
difference?
How do I get this to work?
Thanks
Dim ts As DataGridTableStyle = New DataGridTableStyle()
Dim DataAdp As OleDbDataAdapter = New
OleDbDataAdapter("GetSales", DBvar)
DataAdp.SelectCommand.CommandType =
CommandType.StoredProcedure
If Not IsDBNull(DataAdp) Then
Try
DataAdp.Fill(ds, "Sales")
Catch ex As Exception
MsgBox(ex.Message,
MsgBoxStyle.Critical, "Error:")
End Try
GrdSales.DataSource = ds.Tables("Sales")
End If
ts.MappingName = ds.Tables("Sales").TableName
GrdSales.TableStyles.Clear()
GrdSales.TableStyles.Add(ts)
ts.AllowSorting = False
Dim wd = ts.GridColumnStyles("Amount")
wd.format = "f"
Dim Col1 = ts.GridColumnStyles("SaleDate")
Col1.width = 160
Col1.format = "MMM dd, yyyy" 3 1682
Hi,
Dim cm As CurrencyManager = CType(Me.BindingContext(ds.Tables("Employees")),
CurrencyManager)
Dim pd As System.ComponentModel.PropertyDescriptor =
cm.GetItemProperties()("BirthDate")
Dim colBDay As New DataGridTextBoxColumn(pd, "MMM dd, yyyy")
With colBDay
..MappingName = "BirthDate"
..HeaderText = "Birth Day"
..Width = 100
End With
Ken
--------------------------
"Sebastian Santacroce" <se*******@ilogic.com> wrote in message
news:2e*****************************@phx.gbl... I'm using the code below to change the grid format of a date fields to use "MMM dd, yyyy" and use a currency format for the second column but it totaly ignores it. I've used this method before when using a SQL database and SQLDataAdapter and it has worked fine. However, the other thing is different here is that I'm using the OleDBDataAdapter. Is there some reason that would make a difference? How do I get this to work?
Thanks
Dim ts As DataGridTableStyle = New DataGridTableStyle()
Dim DataAdp As OleDbDataAdapter = New OleDbDataAdapter("GetSales", DBvar) DataAdp.SelectCommand.CommandType = CommandType.StoredProcedure If Not IsDBNull(DataAdp) Then
Try DataAdp.Fill(ds, "Sales") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error:") End Try GrdSales.DataSource = ds.Tables("Sales") End If
ts.MappingName = ds.Tables("Sales").TableName GrdSales.TableStyles.Clear() GrdSales.TableStyles.Add(ts) ts.AllowSorting = False Dim wd = ts.GridColumnStyles("Amount") wd.format = "f" Dim Col1 = ts.GridColumnStyles("SaleDate") Col1.width = 160 Col1.format = "MMM dd, yyyy"
Where would I put this code? Before or after I get the
data from the access database? -----Original Message----- Hi,
Dim cm As CurrencyManager = CType(Me.BindingContext
(ds.Tables("Employees")),CurrencyManager)
Dim pd As System.ComponentModel.PropertyDescriptor = cm.GetItemProperties()("BirthDate")
Dim colBDay As New DataGridTextBoxColumn(pd, "MMM dd,
yyyy") With colBDay
..MappingName = "BirthDate"
..HeaderText = "Birth Day"
..Width = 100
End With Ken
--------------------------
"Sebastian Santacroce" <se*******@ilogic.com> wrote in
messagenews:2e*****************************@phx.gbl... I'm using the code below to change the grid format of a date fields to use "MMM dd, yyyy" and use a currency format for the second column but it totaly ignores it. I've used this method before when using a SQL database
and SQLDataAdapter and it has worked fine. However, the
other thing is different here is that I'm using the OleDBDataAdapter. Is there some reason that would make a difference? How do I get this to work?
Thanks
Dim ts As DataGridTableStyle = New DataGridTableStyle()
Dim DataAdp As OleDbDataAdapter = New OleDbDataAdapter("GetSales", DBvar) DataAdp.SelectCommand.CommandType = CommandType.StoredProcedure If Not IsDBNull(DataAdp) Then
Try DataAdp.Fill(ds, "Sales") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error:") End Try GrdSales.DataSource = ds.Tables("Sales") End If
ts.MappingName = ds.Tables("Sales").TableName GrdSales.TableStyles.Clear() GrdSales.TableStyles.Add(ts) ts.AllowSorting = False Dim wd = ts.GridColumnStyles("Amount") wd.format = "f" Dim Col1 = ts.GridColumnStyles("SaleDate") Col1.width = 160 Col1.format = "MMM dd, yyyy"
.
Hi, http://msdn.microsoft.com/library/de...asicprimer.asp
Ken
------------------
"Sebastian" <se*******@ilogic.com> wrote in message
news:2f*****************************@phx.gbl...
Where would I put this code? Before or after I get the
data from the access database? -----Original Message----- Hi,
Dim cm As CurrencyManager = CType(Me.BindingContext
(ds.Tables("Employees")),CurrencyManager)
Dim pd As System.ComponentModel.PropertyDescriptor = cm.GetItemProperties()("BirthDate")
Dim colBDay As New DataGridTextBoxColumn(pd, "MMM dd,
yyyy") With colBDay
..MappingName = "BirthDate"
..HeaderText = "Birth Day"
..Width = 100
End With Ken
--------------------------
"Sebastian Santacroce" <se*******@ilogic.com> wrote in
messagenews:2e*****************************@phx.gbl... I'm using the code below to change the grid format of a date fields to use "MMM dd, yyyy" and use a currency format for the second column but it totaly ignores it. I've used this method before when using a SQL database
and SQLDataAdapter and it has worked fine. However, the
other thing is different here is that I'm using the OleDBDataAdapter. Is there some reason that would make a difference? How do I get this to work?
Thanks
Dim ts As DataGridTableStyle = New DataGridTableStyle()
Dim DataAdp As OleDbDataAdapter = New OleDbDataAdapter("GetSales", DBvar) DataAdp.SelectCommand.CommandType = CommandType.StoredProcedure If Not IsDBNull(DataAdp) Then
Try DataAdp.Fill(ds, "Sales") Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Error:") End Try GrdSales.DataSource = ds.Tables("Sales") End If
ts.MappingName = ds.Tables("Sales").TableName GrdSales.TableStyles.Clear() GrdSales.TableStyles.Add(ts) ts.AllowSorting = False Dim wd = ts.GridColumnStyles("Amount") wd.format = "f" Dim Col1 = ts.GridColumnStyles("SaleDate") Col1.width = 160 Col1.format = "MMM dd, yyyy"
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Carlos Lozano |
last post by:
Hello Folks!
I have a grid that populates from a table on SQL Server. All datetime with
DBNull value show 1/1/1900 12:00AM ... Instead of just blank ("").
I found a document with the following...
|
by: C Newby |
last post by:
I have a data grid control taht contains a data bound coulmn called "Type".
Depending on the value of "Type" I want to display a corresponding image in
the rendered table cell. So, if the value of...
|
by: JAPHET |
last post by:
I am Trying to Format date in my Datagrid to SHORTDATE format with the
following codes,
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As...
|
by: Tom |
last post by:
I need to make up a 'grid' of controls at run time. The controls (of which I
wrote) I will instantiate, then I need to arrange these in a row/column
layout. For example, let's say I instantiate 20...
|
by: Sebastian Santacroce |
last post by:
How do I get a datetime field from a database to show just
time in the datagrid. The default just shows date.
Thank you
Sebastian
|
by: Tom |
last post by:
I need to display a series of controls (in my case, a custom control) in a
grid-like fashion. This means this particular control would be repeated
multiple times, arranged in a row/column format....
|
by: Smokey Grindle |
last post by:
In .NET 1.1 I could have a column bound with date/time fields.. then say the
format of it was this {0:MMM d,yyyy h:mm tt} and it would display in this
format
Jan 1, 2006 2:03 PM
however in...
|
by: Stephen Plotnick |
last post by:
I have a checkbox in a data grid that does not change it's state until I
actually leave the field. I've done this routine several times in other data
grids without an issue.
I'm using VB.2003.
...
|
by: lupo666 |
last post by:
Hi again,
every I go into Design mode in a report and move something around, it
gets "disaligned" with respect to the underlying grid, either at 8X8
or 9X9 (don't know why at 10X10 you can't see...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
| |