Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 i have a pb creating a customized datagridtextbox

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2006-05-18 : 22:07:19
I have 8 bound columns that display without anyproblem. I m creating my 9th mapped to OptParam and from a customized DataGridTextBoxColumn like this:

Dim DataGridTextBoxColumn9 As New MyDataGridTextBoxColumn

DataGridTextBoxColumn9 = New MyDataGridTextBoxColumn

DataGridTextBoxColumn9.MappingName = "OptParam"

DataGridTextBoxColumn9.HeaderText = "OptParam"

DataGridTableStyle1.GridColumnStyles.Add(DataGridTextBoxColumn9)
My MyDataGridTextBoxColumn class is like this: I only change Paint Sub, the others Subs and events, I don't change them :

Public Class MyDataGridTextBoxColumn

Inherits DataGridTextBoxColumn

Protected Overloads Overrides Sub Paint(ByVal g As System.Drawing.Graphics, ByVal bounds As System.Drawing.Rectangle, ByVal source As System.Windows.Forms.CurrencyManager, ByVal rowNum As Integer, ByVal alignToRight As Boolean)

Dim parent As DataGrid = Me.DataGridTableStyle.DataGrid

Dim s As String = parent(rowNum, 0).ToString() + ((parent(rowNum, 1).ToString()) + " ").Substring(0, 2)

Dim font As Font = New Font("Arial", 8.25F)

g.DrawString(s, font, New SolidBrush(Color.Black), bounds.X, bounds.Y)

font.Dispose()

End Sub

End Class

Then I create my dataset from a table, then I add an extra column called : OptParam like this:

Mydataset.Tables("Options").Columns.Add("OptParam")

The problem: My datagrid fills all the 8 columns that are bound to my table, but leaves the new added OptParam empty with Nulls although I try to put strings in it as shown above in the PAINT method.

Also, When I try to debug, I see that the execution doesn t execute the Paint method. Weird.

Can Anybody help with this?

I apreciate.

JBelthoff
Posting Yak Master

173 Posts

Posted - 2006-05-23 : 07:49:20
From your code I don't see where you are calling the paint sub procedure. If you don't call it i will not run...

JBelthoff
D
odge, Duck, Dip, Dive & Dodge
If a man can dodge a wrench, he can dodge a ball!
Asp Hoting Provider
Go to Top of Page
   

- Advertisement -