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 code, but didn't work.
public void setGridColumnSt yle()
{
DataGridColumnS tyle newColStyle;
newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0];
newColStyle.Nul lText = "";
}
I tried to customize it to my needs as below:
public void setGridColumnSt yle(ref System.Windows. Forms.Grid oGrid, string
sTable, string sColumn)
{
DataGridColumnS tyle newColStyle;
newColStyle = oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn];
newColStyle.Nul lText = "";
}
I always got an error on second line.
I will appreciate any help to do this.
Carlos Lozano www.caxonline.net 4 2564
Carlos Lozano wrote: 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 code, but didn't work.
public void setGridColumnSt yle() { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0]; newColStyle.Nul lText = ""; }
I tried to customize it to my needs as below: public void setGridColumnSt yle(ref System.Windows. Forms.Grid oGrid, string sTable, string sColumn) { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn]; newColStyle.Nul lText = ""; }
I always got an error on second line.
I will appreciate any help to do this.
Carlos Lozano www.caxonline.net
What is the error? Is the error at runtime or design time...
Chris
Hi Chris,
The error is at runtime. It says "object not set to an instance". I know
the grid is not the problem as I can see it after it is populated.
I think it refers to the TableStyles object within the Grid. I Added the
following line to verify:
int nStyles = oGrid.TableStyl es.Count;
nStyles value is zero. I was expecting a value of 1 as the grid was
populated from a table.
Just in case you are wondering, the column formatting setGridColumnSt yle()
is called after the grid is populated.
Any Ideas?
Thank you,
Carlos Lozano
"Chris" wrote: Carlos Lozano wrote: 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 code, but didn't work.
public void setGridColumnSt yle() { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0]; newColStyle.Nul lText = ""; }
I tried to customize it to my needs as below: public void setGridColumnSt yle(ref System.Windows. Forms.Grid oGrid, string sTable, string sColumn) { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn]; newColStyle.Nul lText = ""; }
I always got an error on second line.
I will appreciate any help to do this.
Carlos Lozano www.caxonline.net
What is the error? Is the error at runtime or design time...
Chris
Carlos Lozano wrote: Hi Chris,
The error is at runtime. It says "object not set to an instance". I know the grid is not the problem as I can see it after it is populated. I think it refers to the TableStyles object within the Grid. I Added the following line to verify:
int nStyles = oGrid.TableStyl es.Count;
nStyles value is zero. I was expecting a value of 1 as the grid was populated from a table.
Just in case you are wondering, the column formatting setGridColumnSt yle() is called after the grid is populated.
Any Ideas?
Thank you,
Carlos Lozano
"Chris" wrote:
Carlos Lozano wrote:
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 code, but didn't work.
public void setGridColumnSt yle() { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0]; newColStyle.Nul lText = ""; }
I tried to customize it to my needs as below: public void setGridColumnSt yle(ref System.Windows. Forms.Grid oGrid, string sTable, string sColumn) { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn]; newColStyle.Nul lText = ""; }
I always got an error on second line.
I will appreciate any help to do this.
Carlos Lozano www.caxonline.net
What is the error? Is the error at runtime or design time...
Chris
If newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0]; works and
newColStyle returns something and
oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn]; returns nothing
then the names you are passing in for either sTable or sColumn is
returning nothing. Most likely sTable is the issue.
obj Object = oGrid.TableStyl es[sTable];
Run that line of code and see if obj is set to null; if it does it
means that name of your tablestyle isn't equal sTable.
oGrid.TableStyl es[0].TableName ??? there is some method that will give
you the name of your tablesytle, I don't know what it is called off the
top of my head.
hope it helps.
Chris
Hi Chris,
I just found where the problem is. The Grid does not have a tableStyles.
Grid.TableStyle s.Count = 0 after creating the grid.
I added a TableStyle before populating it from a Table and i can handle the
grid's column properties (width, etc).
What I am still having trouble with isdatetime fields with dbNull values
still display as 1/1/1900 even when the ColumnStyle.Nul lText = "".
Thank you for your help.
Carlos Lozano www.caxonline.net
"Chris" wrote: Carlos Lozano wrote: Hi Chris,
The error is at runtime. It says "object not set to an instance". I know the grid is not the problem as I can see it after it is populated. I think it refers to the TableStyles object within the Grid. I Added the following line to verify:
int nStyles = oGrid.TableStyl es.Count;
nStyles value is zero. I was expecting a value of 1 as the grid was populated from a table.
Just in case you are wondering, the column formatting setGridColumnSt yle() is called after the grid is populated.
Any Ideas?
Thank you,
Carlos Lozano
"Chris" wrote:
Carlos Lozano wrote:
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 code, but didn't work.
public void setGridColumnSt yle() { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0]; newColStyle.Nul lText = ""; }
I tried to customize it to my needs as below: public void setGridColumnSt yle(ref System.Windows. Forms.Grid oGrid, string sTable, string sColumn) { DataGridColumnS tyle newColStyle; newColStyle = oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn]; newColStyle.Nul lText = ""; }
I always got an error on second line.
I will appreciate any help to do this.
Carlos Lozano www.caxonline.net
What is the error? Is the error at runtime or design time...
Chris
If newColStyle = oGrid.TableStyl es[0].GridColumnStyl es[0]; works and newColStyle returns something and oGrid.TableStyl es[sTable].GridColumnStyl es[sColumn]; returns nothing then the names you are passing in for either sTable or sColumn is returning nothing. Most likely sTable is the issue.
obj Object = oGrid.TableStyl es[sTable];
Run that line of code and see if obj is set to null; if it does it means that name of your tablestyle isn't equal sTable.
oGrid.TableStyl es[0].TableName ??? there is some method that will give you the name of your tablesytle, I don't know what it is called off the top of my head.
hope it helps. Chris This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: cody |
last post by:
Iam using Beta2 of VS2005 and getting the error "Error 4 'format-dateTime()'
is an unknown XSLT function" at the following line:
<xsl:value-of select="format-dateTime($pubDate,'
: ')" />
how can I get around this?
|
by: madsgormlarsen |
last post by:
Import of html tables to access (or exel), but it fills a column
instead of a row.
I have tried to import a html tables to access/exel, but both exel and
access fills a column instead of a row.
(or if you prefer a it fills a on field with several data records,
instead of filling all the fields with one data record).
With an example i have both height, width, weight and so fort but in
the first field/column - instead of as I which...
|
by: Sasha |
last post by:
Hi,
What is an easy way to create DateTime from a string that contains date in
the following format "yyyyMMdd"?
Take care,
Sasha
|
by: Doug Swanson |
last post by:
I'm trying to get a datetime value (10/24/2001 6:00 AM) to display as
10/24/01 6:00. I know I could hard code some format but I'm trying to use
the culture info etc. so that (and this is my understanding of it) if in the
web.config I change the culture info to some country that disaplays as
dd/mm/yy hh:mm then my app will display this in that manner.
I can't seem to find any examples using the culture info...on a side note if
I have a...
|
by: Robin Tucker |
last post by:
My database has a column for numeric data items. How can I use
this number in the "format" command, such that for, say precision 2, I get
numbers like 2011.01 or 2387.00 and for 4 I would get 2011.0100 or
2387.0000?
(simple question I know!)
| |
by: Al Reid |
last post by:
First, I'm using vb2005. I have a string that is read from a barcode reader into a TextBox. The string is 6 characters long and
represents a date (mmddyy). I want to display it to the user in a date format of "mm/dd/yy" For example the barcode contains
"112303" and I want to format it to display "11/23/03"
If I use the microsoft.visualbasic.strings.format with a format string of "##/##/##" or "00/00/00" I get the format string in the...
|
by: Darek |
last post by:
Hi,
I have a table, something similar to:
create table my_table (
id char(32) not null primary key,
num integer not null,
code varchar(2) not null,
name varchar(60) not null,
|
by: lgalumbres |
last post by:
Hello,
I have a DataGridView control with a DataGridViewComboBoxColumn that
allows users to choose selections from a list. The DataGridView is
bound to a DataTable object and the DataGridViewComboBoxColumn is bound
to a DataTable as well and the link between the two tables is by a
field called "ClassID" which is of integer data type. Both DataTables
are populated from a server call.
With the DataGridViewComboBoxColumn a user is...
|
by: |
last post by:
Hi,
I program in asp.net. I have a date in TextBox in format "dd/MM/yyyy".
I would like to validate if the date is realy correct.
I used RegularExpressionValidator with
ValidationExpression="//", but user
can write date "31/02/2000" and validator says that it is correct (everybody
know that Febuary has 28 or 29 days).
|
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...
|
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...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |