DataGridView display member

ict-torquilclark
ict-torquilclark used Ask the Experts™
on
I have a datagrid view setup that pulls data from a dataset.

Is there a way I can change the way that the column displays the data. For instance I have a column "Salary" set as datatype double. this may show as 20000.00. can I do something like concatenate a "£" onto the start of the field?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
IT Pro/Developer
Top Expert 2008
Commented:
Hi,
After fill the grid, you can do something like this:

Me.DataGridView1.Columns("Salary").DefaultCellStyle.Format = "£ 000.00"

Author

Commented:
I have added the code that you have suggested into the form.load event handleer and recieved the following error...

Object reference not set to an instance of an obeject

?
Jorge PaulinoIT Pro/Developer
Top Expert 2008

Commented:
But after the datagridview is loaded ? Check if the name of the column is correct ... you can try to use the column index instead of the name.

Author

Commented:
sorry about that my fault.

I had accidentaly removed the column from the datagridview.

I added it back in and its working fine now.

Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial