dear vladk,
i have fixed the fixedrow = 1 and the fixedcol = 1
i have altogether 7 columns and 2 rows by default.(i must have at least 2 rows because if i set the rows to 2, a message will pop up in the msflexgrid property saying that the fixedrow must at least one less that rows, rite?)
my question is, why do i need to have a fixedcol? what is the usage of keeping the fixedcol when i do not need it ('coz the first column is supposed to be the delete column)?
do i need to set the fixed column width to 0, then only starts with the first column(delete column)?
MSFlexGrid1.ColWidth(0) = 0
MSFlexGrid1.ColWidth(1) = 1200
MSFlexGrid1.ColWidth(2) = 1200
MSFlexGrid1.ColWidth(3) = 5200
MSFlexGrid1.ColWidth(4) = 2000
MSFlexGrid1.ColWidth(5) = 2000
MSFlexGrid1.ColWidth(6) = 2000
MSFlexGrid1.TextArray(0) = ""
MSFlexGrid1.TextArray(1) = "Delete"
MSFlexGrid1.TextArray(2) = "Plan Code"
MSFlexGrid1.TextArray(3) = "Plan Name"
MSFlexGrid1.TextArray(4) = "Term/Age"
MSFlexGrid1.TextArray(5) = "Insured Amount"
MSFlexGrid1.TextArray(6) = "Premium"
and another question is each time i delete a row, the text in the msflexfrid1.col(3) have to be add back into the combo list. how do i do this? i have tried the code, but it does not work well. it only return a blank value into the combo box. how can i fix it?
Private Sub MSFlexGrid1_Click()
Dim currentRow As Integer
Dim content As String
On Error GoTo ErrorExit
currentRow = MSFlexGrid1.Row
If MSFlexGrid1.Col = 0 Then
content = MSFlexGrid1.TextMatrix(currentRow, 2)
MSFlexGrid1.RemoveItem MSFlexGrid1.Row
cboPlan.AddItem content /**to add the deleted insurance plan into the combo box
End If
If MSFlexGrid1.Col = 3 And MSFlexGrid1.TextMatrix(currentRow, 2) = "Whole Life 87" Then
frameWholeLife.Visible = True
frameAllPlanDetails.Visible = False
Else
If MSFlexGrid1.Col = 3 And MSFlexGrid1.TextMatrix(currentRow, 2) = "Endowment" Then
frmQuoteComparison.Show
Else
If MSFlexGrid1.Col = 3 And MSFlexGrid1.TextMatrix(currentRow, 2) = "Term Plan" Then
frmTerm.Show
End If
End If
End If
ErrorExit:
If Err.Number = 30015 Then
Err.Clear
MSFlexGrid1.Rows = 1
End If
End Sub
thanks! =)