Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I am using a DataGrid to display data while it is being acquired from a rack of instruments. It works fine except that it seems to ignore the column formats that I have specified. I want to display my measurement with a fixed 5 decimal places, so I did the following:

 

Dim tbcDataAcquisition As New DataGridTextBoxColumn
With tbcDataAcquisition
   .HeaderText = "Measurement"
   .Width = 75
   .MappingName = "measurement"
   .Format = "F5"
End With
GridTableStyle.GridColumnStyles.Add(tbcDataAcquisition)

 

I then add this style to my DataGrid in the Form.Load statement:

 

dgDataAcquisition.TableStyles.Add(oStep.GridTableStyle)
oStep.GridTableStyle.MappingName = "test_data"

 

The header text, and width are formatted properly, but the data format is not. Anyone have any idea what is going on? I read somewhere that you need to add the style to the DataGrid after filling it with data...is this true? If so, this won't work for me...since I want to display the data as it is acquired. Any suggestions?

 

By the way, it is not entirely clear on what they expect in the Format field, so I also tried:

 

.Format = "{0:F5}"

 

and

 

.Format = "0.00000"

 

and

 

.Format = "{0:0.00000}"

 

It ignores everything.

 

Thanks for your help,

 

Todd

Edited by tfowler

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...