Click here to Skip to main content
16,005,149 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Create and access Long file names Pin
Dave Kreskowiak2-Nov-05 6:51
mveDave Kreskowiak2-Nov-05 6:51 
GeneralRe: Create and access Long file names Pin
Zenly2-Nov-05 7:19
Zenly2-Nov-05 7:19 
GeneralRe: Create and access Long file names Pin
Dave Kreskowiak2-Nov-05 7:59
mveDave Kreskowiak2-Nov-05 7:59 
GeneralRe: Create and access Long file names Pin
Zenly2-Nov-05 8:45
Zenly2-Nov-05 8:45 
QuestionAn existing connection was forcibly closed by the remote host Pin
Spaz801-Nov-05 2:12
Spaz801-Nov-05 2:12 
QuestionRepaint only sections of a screen? Pin
spelltwister31-Oct-05 23:33
spelltwister31-Oct-05 23:33 
QuestionCapture image in memory Pin
spelltwister31-Oct-05 23:29
spelltwister31-Oct-05 23:29 
QuestionConditional formatting DataGrid columns Pin
Mashinovodja31-Oct-05 23:11
Mashinovodja31-Oct-05 23:11 
I have a DataGrid on a Windows form that I populate using a DataSet object. Two of the columns may contain fields with Null values. When both fields in a row are Null, no problem, I display blank cells in the grid using a TableStyle object.
But if the first field in a row is not Null and the second one is Null, I would like to display in the second cell of the grid some text, such as "uknown", or "not applicable" (or maybe color the cell differently). Looping one by one through all DataGrid rows after populating the grid and examining cells data is not an option as I expect the grid to contain up to 2500 rows, so the whole process could be noticeably slow.

I first thought about using multiple table column styles, but I can't figure out how to switch from one style to another based data read at runtime.

I also tried this approach:

' populate the grid
objDGrid.DataSource = objDataSet
'
' define a currency manager
objCurMgr = CType(objDGrid.BindingContext(objDataSet, "openTasks"), CurrencyManager)
'
' define a Binding object attached to the "DataSource" 
' property of the DataGrid
If Not (mobjBndg Is Nothing) Then
   objDGrid.DataBindings.Remove(mobjBndg)
End If
mobjBndg = New Binding("DataSource", objDataSet, "openTasks")
objDGrid.DataBindings.Add(mobjBndg)


Outside the code portion of the form, I declared:

Private WithEvents mobjBndg As Binding


My idea was to use the Format and Parse events of the Binding object and change in code the formatting of data displayed in cells. I thought the Format event should fire once for each cell in a row when the DataGrid is being populated. But it never does. Why? Confused | :confused: What am I missing or doing wrong? Is there a better way to accomplish what I want? Can anyone shed more light?

I Googgled with "DataGrid + binding + dynamic formatting" and got zilions of hits, but only examples of simple bindings of controls such as TextBoxes. I couldn't get any example of complex data binding and dynamic formatting of a DataGrid control.

Thank you in advance for any suggestions and hints.
QuestionHelp me please. Pin
Uthen31-Oct-05 15:51
Uthen31-Oct-05 15:51 
AnswerRe: Help me please. Pin
MalikRizwan31-Oct-05 21:00
MalikRizwan31-Oct-05 21:00 
AnswerRe: Help me please. Pin
david_newman1-Nov-05 14:01
david_newman1-Nov-05 14:01 
GeneralRe: Help me please. Pin
Uthen1-Nov-05 15:39
Uthen1-Nov-05 15:39 
GeneralRe: Help me please. Pin
david_newman1-Nov-05 16:52
david_newman1-Nov-05 16:52 
Questiongraph/network type: how do i manage it? Pin
fuel2run31-Oct-05 14:18
fuel2run31-Oct-05 14:18 
Questionhex to uint32 conversion Pin
Madvanman31-Oct-05 13:09
Madvanman31-Oct-05 13:09 
AnswerRe: hex to uint32 conversion Pin
Christian Graus31-Oct-05 13:38
protectorChristian Graus31-Oct-05 13:38 
GeneralRe: hex to uint32 conversion Pin
Madvanman31-Oct-05 13:53
Madvanman31-Oct-05 13:53 
GeneralRe: hex to uint32 conversion Pin
Christian Graus31-Oct-05 13:56
protectorChristian Graus31-Oct-05 13:56 
GeneralRe: hex to uint32 conversion Pin
Madvanman31-Oct-05 14:20
Madvanman31-Oct-05 14:20 
QuestionWeb service question Pin
maxiachun31-Oct-05 12:21
maxiachun31-Oct-05 12:21 
AnswerRe: Web service question Pin
Christian Graus31-Oct-05 12:56
protectorChristian Graus31-Oct-05 12:56 
QuestionVS 2005 My.Settings Pin
Brent Lamborn31-Oct-05 10:10
Brent Lamborn31-Oct-05 10:10 
QuestionVB.Net code conversion Pin
GambleJ31-Oct-05 9:38
GambleJ31-Oct-05 9:38 
AnswerRe: VB.Net code conversion Pin
Christian Graus31-Oct-05 11:21
protectorChristian Graus31-Oct-05 11:21 
GeneralRe: VB.Net code conversion Pin
Dave Doknjas31-Oct-05 13:15
Dave Doknjas31-Oct-05 13:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.