Hello all,
Can anyone tell me how to *add* rows to a stylegrid that already has data?
This is the existing code, which works fine to add records all at once. But to add more, the existing are deleted.
The line that appears to control the deletion is "grdAlarmActivity.Rows = 0". However, if this is remarked out, no lines are ever display.
Ideas would be greatly appreciated!
Thank you,
Tim
Dim i as Integer
Dim pCell as StyleGridCell
Dim pRow as StyleGridRow
Dim pStyle as StyleGridStyle
grdAlarmActivity.Rows = 0
grdAlarmActivity.Cols = 5
Dim W As Integer =grdAlarmActivity.Width
grdAlarmActivity.Column(1).Width = 65
grdAlarmActivity.Column(2).Width = 50
grdAlarmActivity.Column(3).Width =125 //Date/Time
grdAlarmActivity.Column(4).Width = 150 //Tenant Name
For i = 1 to 4
w = w -grdAlarmActivity.Column(i).Width
Next i
grdAlarmActivity.Column(5).Width = w
grdAlarmActivity.Column(1).Header.Text = "Unit"
grdAlarmActivity.Column(2).Header.Text = "Door"
grdAlarmActivity.Column(3).Header.Text = "Date/Time"
grdAlarmActivity.Column(4).Header.Text = "Tenant"
grdAlarmActivity.Column(5).Header.Text = "Alarm?"
grdAlarmActivity.Column(1).Alignment = 0
If App.eDatabaseOpen = False Then Return
grdAlarmActivity.LockDrawing = true
Dim d As New Date
Dim Parse As New modinet.clsParse
//Dim Result As Integer = 0
Call Parse.Parse(Data,"+",10)
'Check to see if Alarm is Assigned
' 100 'Dr Closed No Alarm
' 101 'Dr Open No Alarm
' 102 'Dr Closed Alarm
' 103 'Dr Opened Alarm
'104 'Mux Tamper
' 110 'Dr Closed No Alarm/Not Enabled
' 111 'Dr Open No Alarm/Not Enabled
If Val(Parse.ReturnArray(2)) <> 100 or Val(Parse.ReturnArray(2)) <> 101 Then
'0 100:100
'1 0
'2 110 //Event Code
'3 date/time
'4 message
'5 Alarm not warranted
'6 unit
'7 dr state
'8 Fname
'9 Lname
pRow = new StyleGridRow(grdAlarmActivity)
pCell = pRow.WritableCell(1)
pCell.Text =Parse.ReturnArray(6)
pCell.Style = pStyle
pCell.LeftIndent = 25 // Make Space for the picture
If Parse.ReturnArray(7) = "O" Then pRow.WritableCell(2).Text ="Open" //"Doors state"
If Parse.ReturnArray(7) = "C" Then pRow.WritableCell(2).Text ="Closed" //"Doors state"
pRow.WritableCell(3).Text = Parse.ReturnArray(3)
Dim LN as String = Mid(Parse.ReturnArray(9),1,Len(Parse.ReturnArray(9))-1)
pRow.WritableCell(4).Text = Parse.ReturnArray(8) + " " + Ln
pRow.WritableCell(5).Text = Parse.ReturnArray(5)
grdAlarmActivity.AppendRow(pRow)
End If
//grdAlarmActivity.Column(1).Alignment = 0
For i = 1 to 5
grdAlarmActivity.Column(i).Alignment = 0
Next i
grdAlarmActivity.LockDrawing = false