Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
910
PerformAutoResize is not working
posted

I've populated an unbound grid, and even put a delay in to make sure it's populated, but the auto resize after that does not work - i.e. if I click on the column boundary between columns 1 & 2, column 1 obediently shrinks down - but this code is not doing the same thing:

The code to populate and resize:

Private Sub Populate_Products_Grids()
Try
Grd_Prods.DataSource = Nothing
Catch ex As Exception
End Try
Me.Cursor = Cursors.WaitCursor
UseWaitCursor = True
Application.DoEvents()
Threading.Thread.Sleep(100) 'WAITING FOR THE CODE TO FINISH
ConnectString = "Server = xx.xxxx.xx.xx; Log File=cprovider.log;Port=1972; Namespace=" & CompName & "; Password = TEST; User ID = TEST;"
Try
cnCache = New InterSystems.Data.CacheClient.CacheConnection(ConnectString)
cnCache.Open()
dsCache = New DataSet()
daCache = New InterSystems.Data.CacheClient.CacheDataAdapter
SQLstmt = "SELECT Convert(bit,0) as Choose, Product, Description FROM MVFILE.PRODUCTS"
daCache.SelectCommand = New InterSystems.Data.CacheClient.CacheCommand(SQLstmt, cnCache, txCache)
daCache.Fill(dsCache, "Sample_Person")
dtCache = dsCache.Tables("Sample_Person")
Grd_Prods.DataSource = dtCache
Catch eLoad As Exception
MessageBox.Show("An error has occurred: " + eLoad.Message)
Application.Exit()
End Try
Threading.Thread.Sleep(100) 'WAITING FOR THE CODE TO FINISH
Grd_Prods.DisplayLayout.Bands(0).Columns(1).PerformAutoResize(PerformAutoSizeType.AllRowsInBand)
Grd_Prods.DisplayLayout.Bands(0).Columns(2).PerformAutoResize(PerformAutoSizeType.AllRowsInBand)
UseWaitCursor = False
Me.Cursor = Cursors.Default
Application.DoEvents()
Threading.Thread.Sleep(100) 'WAITING FOR THE CODE TO FINISH
End Sub

In addition, this grid is read-only, which is what I want, sort of, but I'm not sure how this is accomplished globally (I used a preset read-only style), nor how to override it for a column. I have a checkbox column (created within the SQL statement, as you can see above), and I'm trying to let them check/uncheck boxes in that column while prohibiting any other kinds of editing, but it's not working:

My Initialize: 

Private Sub Grd_Prods_InitializeLayout(sender As Object, e As InitializeLayoutEventArgs) Handles Grd_Prods.InitializeLayout
e.Layout.Bands(0).Columns(0).CellActivation = Activation.AllowEdit
e.Layout.Bands(0).Columns(0).CellClickAction = CellClickAction.Edit
End Sub

Parents Reply Children
No Data