I am interested in dynamically generating textboxes from reading the column names of listview values. I would then like to be able to access the textboxes from the editing form ($frmEdit) and return the contents to the listview. I have been successful in generating the textboxes and successfully populating them on the first execution. However subsequent executions do not increment to the current selected row. First execution of the function is sent a value of false to halt generation of subsequent textboxes once they have initially been created and turned off on exit of the function.

 Code:
$ListViewEx1.SelectedItem.Index is sent to the $pos in the function.

Function Create_Form($pos)
 $col = 181
 $row = 10
  ReDim $aSelected[$ListViewEx1.Columns.Count - 1]
  For $e = 0 to ubound($aSelected)
   $aSelected[$e]=$ListViewEx1.Items($pos).Subitems($e).text
  Next
 For $d = 0 to $ListViewEx1.Columns.Count - 1
  IF $bfrmEdit="False"
   $nc=chr(36)+"Column"+($ListViewEx1.Columns($d).Index)
   $nc = $frmEdit.Controls.Add("TextBox")
   $nc.location = $col, $row
   $nc.Size = 200, 20
   $nc.ToolTip ="Column"+($ListViewEx1.Columns($d).Index)
   $row = $row + 20
   $btnOk.Top=$nc.top + 30
   $btnCancel.Top=$nc.top + 30
   $frmEdit.ClientSize = 400, $nc.bottom + 95
   $frmEdit.MaximumSize = 400, $nc.bottom + 95
   $nc.text = $aSelected[$d] 
   Else
   $nc.text = $aSelected[$d] 
  EndIf
 Next
 $bfrmEdit="True"
EndFunction


Edited by Mart (2011-11-01 09:41 AM)
Edit Reason: Please use code tags when posting code.
_________________________
Dr Rick
Computer Specialist