KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Deleting a row in GridView

 
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic
View previous topic :: View next topic  
Author Message
Chad
KiXforms Novice
KiXforms Novice


Joined: 20 Nov 2008
Posts: 4

PostPosted: Fri May 29, 2009 1:03 pm    Post subject: Deleting a row in GridView Reply with quote

I know the Gridview is undocumented, but I need it for my current project as I have a need for cells with Combo Boxes and checkboxes.

What I'm having difficulty with is removing the selected row from the grid. I've looked a the gv.kix example posted here which indicates that:

$GridView.Rows.Remove($CurrentRowIndex)

Ought to work, only it doesn't. In fact, the gv.kix code itself no longer works so I guess there's been a syntax change somewhere along the way.

Any pointers?

KF Classic, 2.47.4.0

Thanks!
Back to top
View user's profile Send private message
benny69
KiXforms Advocate
KiXforms Advocate


Joined: 30 Oct 2003
Posts: 567
Location: Lincoln, Ne

PostPosted: Fri May 29, 2009 6:34 pm    Post subject: Reply with quote

I am running KiXforms.Classic 2.46 and I am seeing the same thing with this code:

Code:

NewClick(50,8)

$Form.Center
$Form.Show

While $Form.Visible
 $= Execute($Form.DoEvents())
Loop

SaveSettings()

Exit 1

Function GridStrings($grid)

; $GridStrings = $System.Object()

; $GridStrings.Title = "Grid"
; $GridStrings.Author = "Shawn Tassie"
; $GridStrings.Version = "1.0"
; $GridStrings.NoRefCell = "Please select a reference"
; $GridStrings.Ready = "Ready"
; $GridStrings.DefaultExt = ".grd"
; $GridStrings.Filter =
; $GridStrings.ImportTitle = "Import Access Database"
; $GridStrings.ImportDefaultExt = ".mdb"
; $GridStrings.ImportFilter = "Microsoft Access (*.mdb)|*.mdb|All Files (*.*)|*.*"
; $GridStrings.ChooseTableTitle = "Choose Table"

EndFunction

Function GridMenu($grid)

 Dim $


EndFunction

Function GridLoadSettings($grid)

 Dim $fn, $font

 $key = "HKCU\Software\Kixforms\Gridview"

 $grid.Left = ReadValueEx($key, "Left", 100)
 $grid.Top = ReadValueEx($key, "Top", 100)
 $grid.Width = ReadValueEx($key, "Width", 640)
 $grid.Height = ReadValueEx($key, "Height", 480)

 ;; font has to be set first else header bug.

 $grid.ActiveSheet.FontName = ReadValueEx($key, "FontName","Verdana")
 $grid.ActiveSheet.FontSize = ReadValueEx($key, "FontSize",8)

 GridUpdateUI($grid)

EndFunction

Function SaveSettings()

 Return; disabled for now

 Dim $, $profile

 $fn = @SCRIPTDIR + "\grid.ini"

 $= WriteProfileString($fn, "settings", "Top", $grid.Top)
 $= WriteProfileString($fn, "settings", "Left", $grid.Left)
 $= WriteProfileString($fn, "settings", "Width", $grid.Width)
 $= WriteProfileString($fn, "settings", "Height", $grid.Height)

 $= WriteProfileString($fn, "settings", "BackColor", $grid.ActiveSheet.BackColor)
 $= WriteProfileString($fn, "settings", "ColumnHeaderStyle", $grid.ActiveSheet.ColumnHeaderStyle)
 $= WriteProfileString($fn, "settings", "FontName", $grid.ActiveSheet.FontName)
 $= WriteProfileString($fn, "settings", "FontSize", $grid.ActiveSheet.FontSize)
 $= WriteProfileString($fn, "settings", "ForeColor", $grid.ActiveSheet.ForeColor)
 $= WriteProfileString($fn, "settings", "FullRowSelect", $grid.ActiveSheet.FullRowSelect)

EndFunction

;; menu actions

Function NewClick(Optional $RowCount, Optional $ColumnCount)

 Dim $InputBox, $RowCount, $ColumnCount

 $InputBox = $System.InputBox()

 If Not $ColumnCount

  $InputBox.Title = "ColumnCount"
  $InputBox.Prompt = "Number of columns ..."
  $InputBox.Default = 8

  $ColumnCount = Val($InputBox.Show())

  If $InputBox.DialogResult <> $System.DialogResult.OK
   Return
  EndIf

 EndIf

 If Not $RowCount

  $InputBox.Title = "RowCount"
  $InputBox.Prompt = "Number of rows ..."
  $InputBox.Default = 100

  $RowCount = Val($InputBox.Show())

  If $InputBox.DialogResult <> $System.DialogResult.OK
   Return
  EndIf

 EndIf

 $MainSplit.Panel1Collapsed = 1

 $GridView.BeginUpdate
 $GridView.RowCount = 0
 $GridView.ColumnCount = 0
 $GridView.ColumnCount = $ColumnCount
 $GridView.RowCount = $RowCount

 For $i = 0 to $GridView.ColumnCount - 1
  $GridView.Columns($i).Name = Chr(65+$i)
 Next

 $GridView.CurrentRowIndex = 0
 $GridView.CurrentColumnIndex = 0
 $GridView.EndUpdate

 UpdateUI()

EndFunction

Function SaveClick()

 Dim $SavedStatus, $column
 Dim $Items, $Item
 Dim $fn

 If $SaveFileDialog.Filename = ""
  SaveAsClick()
  Return
 EndIf

 $fn = $SaveFileDialog.Filename

 $Form.Cursor = $System.CursorStyle.WaitCursor

 If Exist($fn)
  Del "$fn"
 EndIf

 $SavedStatus = $StatusBar.StatusLabel.Text

 $StatusBar.StatusLabel.Text = "Saving $fn ..."

 $= WriteProfileString($fn,"Grid","RowCount",$GridView.RowCount)
 $= WriteProfileString($fn,"Grid","ColumnCount",$GridView.ColumnCount)

 $= WriteProfileString($fn,"Grid","AllowSorting",$GridView.AllowSorting)
 $= WriteProfileString($fn,"Grid","AlternatingBackColor",$GridView.AlternatingBackColor)
 $= WriteProfileString($fn,"Grid","BackColor",$GridView.BackColor)
 $= WriteProfileString($fn,"Grid","ColumnHeaderStyle",$GridView.ColumnHeaderStyle)
 $= WriteProfileString($fn,"Grid","FontName",$GridView.FontName)
 $= WriteProfileString($fn,"Grid","FontSize",$GridView.FontSize)
 $= WriteProfileString($fn,"Grid","ForeColor",$GridView.ForeColor)
 $= WriteProfileString($fn,"Grid","GridLineColor",$GridView.GridLineColor)
 $= WriteProfileString($fn,"Grid","Locked",$GridView.Locked)
 $= WriteProfileString($fn,"Grid","SelectionMode",$GridView.SelectionMode)

 ; items ...

 For $i = 0 to $GridView.ColumnCount - 1

  $Column = $GridView.Columns($i)

  $= WriteProfileString($fn,"$i","Alignment",$Column.Alignment)
  $= WriteProfileString($fn,"$i","BackColor",$Column.BackColor)
  $= WriteProfileString($fn,"$i","BackColor",$Column.BackColor)
  $= WriteProfileString($fn,"$i","CellType",$Column.CellType)
  $= WriteProfileString($fn,"$i","ForeColor",$Column.ForeColor)
  $= WriteProfileString($fn,"$i","Format",$Column.Format)
  $= WriteProfileString($fn,"$i","Name",$Column.Name)
  $= WriteProfileString($fn,"$i","Locked",$Column.Locked)
  $= WriteProfileString($fn,"$i","Width",$Column.Width)
  $= WriteProfileString($fn,"$i","ValueType",$Column.ValueType)

  ;; Items ...

  If $Column.Items
   For Each $Item in $Column.Items
    $Items = $Items + $Item.Text + "|"
   Next
   $= WriteProfileString($fn,"$i","Items",$Items)
  EndIf

 Next

 For $i = 0 to $GridView.RowCount - 1
  For $j = 0 to $GridView.ColumnCount - 1
   If VarType($GridView.Cells($i,$j).Value) <> 0
    $= WriteProfileString($fn,"$i.$j","Value",$GridView.Cells($i,$j).Value)
   EndIf
  Next
 Next

 $Form.Cursor = $System.CursorStyle.Default

 $StatusBar.StatusLabel.Text = $SavedStatus

 $Form.Text = $TITLE + " - " + SubStr($fn,InStrRev($fn,"\")+1)

EndFunction

Function OpenClick()

 Dim $fn, $sheet, $column
 Dim $Items, $Item

 If $OpenFileDialog.ShowDialog() <> $System.DialogResult.Ok
  Return
 EndIf

 $fn = $OpenFileDialog.Filename

 $MainSplit.Panel1Collapsed = 1

 If SubStr($fn, InStrRev($fn,".")) = ".mdb"
  Exit ImportAccess($fn)
 EndIf

 If SubStr($fn, InStrRev($fn,".")) <> ".grd"
  Exit 1
 EndIf

 $Form.Cursor = $System.CursorStyle.WaitCursor

 $GridView.BeginUpdate()

 ;; Tear-down the sheet, do rows first.

 $GridView.RowCount = 0
 $GridView.ColumnCount = 0

 ;; rebuild the sheet, do columns first.

 $GridView.ColumnCount = ReadProfileString($fn,"Grid","ColumnCount")
 $GridView.RowCount = ReadProfileString($fn,"Grid","RowCount")

 $GridView.AllowSorting = ReadProfileString($fn,"Grid","AllowSorting")
 $GridView.AlternatingBackColor = Val(ReadProfileString($fn,"Grid","AlternatingBackColor"))
 $GridView.BackColor = Val(ReadProfileString($fn,"Grid","BackColor"))
 $GridView.ColumnHeaderStyle = Val(ReadProfileString($fn,"Grid","ColumnHeaderStyle"))

 If ReadProfileString($fn,"Grid","FontName")
  $GridView.FontName = ReadProfileString($fn,"Grid","FontName")
  $GridView.FontSize = ReadProfileString($fn,"Grid","FontSize")
 EndIf

 $GridView.ForeColor = Val(ReadProfileString($fn,"Grid","ForeColor"))
 $GridView.GridLineColor = Val(ReadProfileString($fn,"Grid","GridLineColor"))
 $GridView.Locked = Val(ReadProfileString($fn,"Grid","Locked"))
 $GridView.SelectionMode = Val(ReadProfileString($fn,"Grid","SelectionMode"))

 Dim $Column

 For $i = 0 to $GridView.ColumnCount - 1

  $Column = $GridView.Columns($i)

  $Column.Alignment = Val(ReadProfileString($fn,"$i","Alignment"))
  $Column.BackColor = Val(ReadProfileString($fn,"$i","BackColor"))
  $Column.CellType = Val(ReadProfileString($fn,"$i","CellType"))
  $Column.ForeColor = Val(ReadProfileString($fn,"$i","ForeColor"))
  $Column.Format = ReadProfileString($fn,"$i","Format")
  $Column.Items = Split(ReadProfileString($fn,"$i","Items"), ";")
  $Column.Name = ReadProfileString($fn,"$i","Name")
  $Column.Locked = ReadProfileString($fn,"$i","Locked")
  $Column.Width = Val(ReadProfileString($fn,"$i","Width"))
  $Column.ValueType = Val(ReadProfileString($fn,"$i","ValueType"))

  ;; Items ...

  $Items = ReadProfileString($fn,"$i","Items")

  If $Items
   $Column.Items = $System.ListItemCollection()
   For Each $Item in Split($Items,"|")
    If $Item
     $Column.Items.Add($Item)
    EndIf
   Next
  EndIf

 Next

 For $i = 0 to $GridView.RowCount - 1
  For $j = 0 to $GridView.ColumnCount - 1
   If ReadProfileString($fn,"$i.$j","Value")
    $GridView.Cells($i,$j).Value = ReadProfileString($fn,"$i.$j","Value")
   EndIf
  Next
 Next

 $GridView.CurrentRowIndex = 0
 $GridView.CurrentColumnIndex = 0

 $GridView.EndUpdate()

 $Form.Cursor = $System.CursorStyle.Default

 $Form.Text = $TITLE + " - " + SubStr($fn,InStrRev($fn,"\")+1)

 $SaveFileDialog.Filename = $OpenFileDialog.Filename

 UpdateUI()

EndFunction

Function SaveAsClick()

 If $SaveFileDialog.ShowDialog() <> $System.DialogResult.Ok

  Return

 EndIf

 SaveClick()

EndFunction

Function ImportAccess($fn)

 Dim $Connection
 Dim $RecordSet, $Column, $Rows
 Dim $Node

 $Connection = CreateObject("ADODB.Connection")
 If @ERROR = 0
  $= $Connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$fn;")
  If @ERROR = 0
   $Schema = $Connection.OpenSchema(20)
   If @ERROR = 0
    $Schema.MoveFirst
    $TablesNode.Nodes.Clear()
    $ViewsNode.Nodes.Clear()
    While Not $Schema.EOF
     If $Schema.Fields("TABLE_TYPE") = "TABLE"
      $Node = $TablesNode.Nodes.Add($Schema.Fields("TABLE_NAME"))
     EndIf
     If $Schema.Fields("TABLE_TYPE") = "VIEW"
      $Node = $ViewsNode.Nodes.Add($Schema.Fields("TABLE_NAME"))
     EndIf
     $Schema.MoveNext
    Loop
    $TablesNode.Expand()
    $ViewsNode.Expand()
    $TreeView.Tag = $fn
    $MainSplit.Panel1Collapsed = 0
   EndIf
  EndIf
 EndIf

 Return

EndFunction

Function TreeViewDoubleClick()

 Dim $fn, $tn
 Dim $RecordSet

 $fn = $TreeView.Tag
 $tn = $TreeView.SelectedNode.Text

 $RecordSet = CreateObject("ADODB.RecordSet")

 If @ERROR = 0

  $RecordSet.Open("[$tn]", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$fn;")

  If @ERROR = 0

   $Form.Cursor = $System.CursorStyle.WaitCursor

   $GridView.BeginUpdate()
   $GridView.RowCount = 0
   $GridView.ColumnCount = 0

   For Each $Field in $RecordSet.Fields
    $Column = $GridView.Columns.Add($Field.Name)
    $Column.ValueType = $Field.Type;
   Next

   $Rows = $RecordSet.GetRows()

   If @ERROR = 0

    $GridView.RowCount = UBound($Rows,2) + 1

    $StatusBar.StatusLabel.Text = "Loading $tn ..."
    $StatusBar.ProgressBar1.Minimum = 0
    $StatusBar.ProgressBar1.Maximum = $GridView.RowCount
    $StatusBar.ProgressBar1.Step = 1
    $StatusBar.ProgressBar1.Value = 0

    For $Row = 0 to UBound($Rows,2)
     $StatusBar.ProgressBar1.PerformStep()
     For $Col = 0 to UBound($Rows,1)
      $GridView.Cells($Row,$Col).Value = $Rows[$Col,$Row]
     Next
    Next

   EndIf

  EndIf

  $StatusBar.ProgressBar1.Value = 0
  $GridView.CurrentRowIndex = 0
  $GridView.CurrentColumnIndex = 0
  $GridView.EndUpdate()
  $Form.Cursor = $System.CursorStyle.Default
  $StatusBar.StatusLabel.Text = "Ready"
  $Form.Text = $tn + " - " + $fn
  $GridView.Focus()
 EndIf

 $RecordSet = 0

 UpdateUI()

EndFunction

Function HeaderButtonClick()

 $MainSplit.Panel1Collapsed = 1

EndFunction

Function AddRowClick()

 Dim $row
 
 $Row = $GridView.Rows.Add()

 UpdateUI()

EndFunction

Function InsertColumnClick()

 Dim $Column
 
 $Column = $GridView.Columns.Insert($GridView.CurrentColumnIndex)

 UpdateUI()

EndFunction

Function InsertRowClick()

 Dim $row
 
 $Row = $GridView.Rows.Insert($GridView.CurrentRowIndex)

 UpdateUI()

EndFunction

Function LoadTreeView($fn)

 Dim $Connection, $Schema

 $Connection = CreateObject("ADODB.Connection")
 If @ERROR = 0
  $= $Connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$fn;")
  If @ERROR = 0
   $Schema = $Connection.OpenSchema(20)
   If @ERROR  = 0
    $Schema.MoveFirst
    $TableNode.Nodes.Clear()
    While Not $Schema.EOF
     If $Schema.Fields("TABLE_TYPE") = "TABLE"
      $Node = $TableNode.Nodes.Add($Schema.Fields("TABLE_NAME"))
      ;$Row = $Dialog.TableView.Rows.Add()
      ;$Row.Cells(0).Text = $Schema.Fields("TABLE_NAME")
      ;$Row.Cells(0).ImageIndex = 0
      ;$Row.Cells(1).Text = $Schema.Fields("DESCRIPTION")
      ;$Row.Cells(2).Text = $Schema.Fields("TABLE_TYPE")
      ;$Row.Cells(3).Text = $Schema.Fields("DATE_MODIFIED")
      ;$Row.Cells(4).Text = $Schema.Fields("DATE_CREATED")
     EndIf
     $Schema.MoveNext
    Loop
    $TableNode.Expand()
    $TreeView.Tag = $fn
    $MainSplit.SplitterDistance = 0.25 * $MainSplit.ClientWidth;
   EndIf
  EndIf
 EndIf

 $Schema = 0
 $Connection = 0

EndFunction

Function DeleteRowClick()

; If $GridView.CurrentRowIndex = -1
;  Return
; Endif

 $GridView.Rows.Remove($GridView.CurrentRowIndex)
 UpdateUI()

EndFunction

Function FindTextClick()

 Dim $InputBox, $Text, $Index

 $InputBox = $System.InputBox()
 $InputBox.Title = "Column Find..."
 $InputBox.Prompt = "Find what: "
 $InputBox.Default = ""

 $Text = $InputBox.Show()

 If $InputBox.DialogResult = $System.DialogResult.Ok
  $Index = $GridView.CurrentColumn.Find($Text)
  If $Index <> -1
   $GridView.CurrentRowIndex = $Index
  EndIf
 EndIf

EndFunction

Function CurrentRowIndexClick()

 Dim $InputBox, $RowIndex

 $InputBox = $System.InputBox()
 $InputBox.Title = "CurrentRowIndex"
 $InputBox.Prompt = "Enter new value for CurrentRowIndex: "
 $InputBox.Icon = "shell32.dll;44"
 $InputBox.Default = $GridView.CurrentRowIndex

 $RowIndex = Val($InputBox.Show())

 If $InputBox.DialogResult = $System.DialogResult.Ok
  $GridView.CurrentRowIndex = $RowIndex
 EndIf

EndFunction

Function TablesViewClick()

 $MainSplit.Panel1Collapsed = Not $MainSplit.Panel1Collapsed

 UpdateUI()

EndFunction

Function AlignmentClick($item, $align)

 Dim $object

 Select
  Case $item = 1 $object = $GridView.CurrentColumn
  Case $item = 2 $object = $GridView.CurrentCell
 EndSelect

 $object.Alignment = $align

 UpdateUI()

EndFunction

Function ColumnWidthClick()

 If $GridView.CurrentColumn.Index = -1
  Return
 EndIf

 Dim $InputBox, $Width

 $InputBox = $System.InputBox()
 $InputBox.Title = "Column Width"
 $InputBox.Prompt = "Enter new column width: "
 $InputBox.Icon = "shell32.dll;44"
 $InputBox.Default = $GridView.CurrentColumn.Width

 $Width = $InputBox.Show()

 If $InputBox.DialogResult = $System.DialogResult.Ok
  $GridView.CurrentColumn.Width = $Width
 EndIf

EndFunction

Function AllowSortingClick()

 $GridView.AllowSorting = Not $GridView.AllowSorting
 UpdateUI()

EndFunction

Function AlternatingBackColorClick()

 $GridView.AlternatingBackColor = ChooseColor($GridView.AlternatingBackColor)
 UpdateUI()

EndFunction

Function BackColorClick()

 Dim $cd

 $cd = $System.ColorDialog()

 $cd.Color = $GridView.BackColor

 If $cd.ShowDialog() = $System.DialogResult.Ok

  $GridView.BackColor = $cd.Color
  SaveSettings()

 EndIf

EndFunction

Function ForeColorClick()

 Dim $cd

 $cd = $System.ColorDialog()

 $cd.Color = $GridView.ForeColor

 If $cd.ShowDialog() = $System.DialogResult.Ok

  $GridView.ForeColor = $cd.Color
  SaveSettings()

 EndIf

EndFunction

Function GridLineColorClick()

 $GridView.GridLineColor = ChooseColor($GridView.GridLineColor)

EndFunction

Function ColumnBackColorClick()

 If $GridView.CurrentColumn.Index = -1
  Return;
 EndIf

 Dim $cd

 $cd = $System.ColorDialog()

 $cd.Color = $GridView.CurrentColumn.BackColor

 If $cd.ShowDialog() = $System.DialogResult.Ok

  $GridView.CurrentColumn.BackColor = $cd.Color

 EndIf

EndFunction

Function ColumnClearClick($Type)

 ;; Type= 0=All 1=Formats 2=Contents

 Dim $column, $i, $j

 If Not $GridView.CurrentColumn
  Return
 Else
  $column = $GridView.CurrentColumn
 EndIf

 $GridView.BeginUpdate()

 If $Type = 0 Or $Type = 1 ;; Formats or All ?

  $column.ValueType = -1
  $column.CellType = -1
  $column.Alignment = -1
  $column.BackColor = -1
  $column.ForeColor = -1
  $column.Format = ""

 EndIf

 If $Type = 0 Or $Type = 2 ;; Values or All ?

  $j = $Column.Index

  For $i = 0 to $GridView.RowCount - 1

   $GridView.Rows($i).Cells($j).Value = ""

  Next

 EndIf

 $GridView.EndUpdate()

 UpdateUI()

EndFunction

Function ColumnCellTypeClick($type)

 If $GridView.CurrentColumn.Index <> -1

  $GridView.CurrentColumn.CellType = $type

 EndIf

 UpdateUI()

EndFunction

Function ColumnValueTypeClick($type)

 If $GridView.CurrentColumn <> -1

  $GridView.CurrentColumn.ValueType = $type
  ;; Set format string to "" to be safe.
  $GridView.CurrentColumn.Format = ""
 EndIf

 UpdateUI()

EndFunction

Function ColumnForeColorClick()

 If $GridView.CurrentColumn.Index <> -1
  $GridView.CurrentColumn.ForeColor = ChooseColor($GridView.CurrentColumn.ForeColor)
 EndIf

EndFunction

Function ColumnClearColorsClick()

 If $GridView.CurrentColumn.Index <> -1

  $GridView.CurrentColumn.BackColor = -1
  $GridView.CurrentColumn.ForeColor = -1
 
 EndIf

EndFunction

Function ColumnCountClick()

 Dim $InputBox

 If $GridView.RowCount <> 0
  $= $ErrorBox.Show("RowCount must be zero before ColumnCount can be changed")
  Return
 EndIf

 Return

 $InputBox = $System.InputBox()
 $InputBox.Title = "RowCount"
 $InputBox.Prompt = "Enter RowCount ..."
 $InputBox.Default = "" + $Form.ActiveSheet.RowCount

 $RowCount = Val($InputBox.Show())

 If $InputBox.DialogResult <> $System.DialogResult.OK
  Return
 EndIf

 $GridView.RowCount = $RowCount

 UpdateUI()

EndFunction

Function ColumnFormatClick()

 If $GridView.CurrentColumn.Index = -1
  Return
 EndIf

 Dim $InputBox, $Format

 $InputBox = $System.InputBox()
 $InputBox.Title = "Format"
 $InputBox.Prompt = "Enter new format specifier: "
 $InputBox.Icon = "shell32.dll;44"
 $InputBox.Default = $GridView.CurrentColumn.Format

 $Format = $InputBox.Show()

 If $InputBox.DialogResult = $System.DialogResult.Ok
  $GridView.CurrentColumn.Format = $Format
 EndIf

EndFunction

Function ColumnItemsClick()

 If $GridView.CurrentColumn.Index <> -1
  EditItems($GridView.CurrentColumn)
  UpdateUI()
 EndIf
 
EndFunction

Function ColumnHeaderStyleClick($style)

 If $GridView.CurrentColumn.Index <> -1
  $GridView.ColumnHeaderStyle = $style
  UpdateUI()
 EndIf

EndFunction

Function FontClick()

 Dim $fd

 $fd = $System.FontDialog()
 $fd.Font = $GridView.Font
 If $fd.ShowDialog() = $System.DialogResult.Ok
  $GridView.Font = $fd.Font
  SaveSettings()
 EndIf

EndFunction

Function ColumnNameClick()

 If $GridView.CurrentColumn.Index = -1
  Return
 EndIf

 Dim $Text

 $Text = $GridView.CurrentColumn.Name

 $InputBox = $System.InputBox()
 $InputBox.Title = "Column Name"
 $InputBox.Prompt = "Enter name:"
 $InputBox.Icon = "shell32.dll;44"
 $InputBox.Default = $Text

 $Text = $InputBox.Show()

 If $InputBox.DialogResult = $System.DialogResult.Ok
  $GridView.CurrentColumn.Name = $Text
 EndIf

EndFunction

Function ImageIndexClick($item)

 Dim $Dialog1, $i

 $Dialog1 = $System.Form($Form)
 $Dialog1.Text = "Images"
 $Dialog1.Font = $System.Font("Tahoma", 10)
 $Dialog1.FormBorderStyle = 4
 $Dialog1.ClientSize = 400,300

 ;$Dialog1.SizeGripStyle = 1

 $Dialog1.Splitter1 = $Dialog1.SplitContainer()
 $Dialog1.Splitter1.Dock = "Fill"
 $Dialog1.Splitter1.SplitterDistance = 0.70 * $Dialog1.Splitter1.ClientWidth
 $Dialog1.Splitter1.Panel2.DockPadding = 10,10,10,10

 $Dialog1.ImageList1 = $Dialog1.Splitter1.Panel1.ImageList()
 $Dialog1.ImageList1.ImageSize = 32,32
 For $i = 0 to $System.BuiltinImageList.Images.Count - 1
  $Dialog1.ImageList1.Images.Add($System.BuiltinImageList.Images($i))
 Next

 $Dialog1.ListView1 = $Dialog1.Splitter1.Panel1.ListView()
 $Dialog1.ListView1.Dock = "Fill"
 $Dialog1.ListView1.Columns.Count = 1
 $Dialog1.ListView1.View = 0
 $Dialog1.ListView1.LargeImageList = $Dialog1.ImageList1

 For $i = 0 to $Dialog1.ListView1.LargeImageList.Images.Count - 1
  $Item = $Dialog1.ListView1.Items.Add($i,$i)
 Next

 $Dialog1.OkButton = $Dialog1.Splitter1.Panel2.ToolButton()
 $Dialog1.OkButton.Height = 30
 $Dialog1.OkButton.Text = "OK"
 $Dialog1.OkButton.Dock = "Top"
 $Dialog1.OkButton.DialogResult = $System.DialogResult.Ok

 ;; use abort dialog result to mean "clear"
 $Dialog1.ClearButton = $Dialog1.Splitter1.Panel2.ToolButton()
 $Dialog1.ClearButton.Height = 30
 $Dialog1.ClearButton.Text = "Clear"
 $Dialog1.ClearButton.Dock = "Top"
 $Dialog1.ClearButton.DialogResult = $System.DialogResult.Abort

 $Dialog1.CancelButton = $Dialog1.Splitter1.Panel2.ToolButton()
 $Dialog1.CancelButton.Height = 30
 $Dialog1.CancelButton.Text = "Cancel"
 $Dialog1.CancelButton.Dock = "Top"
 $Dialog1.CancelButton.DialogResult = $System.DialogResult.Cancel

 $Dialog1.Center
 $Dialog1.Show
 $Dialog1.ListView1.Focus

 If $Dialog1.ShowDialog = $System.DialogResult.Cancel
  Return
 EndIf

 If $Dialog1.DialogResult = $System.DialogResult.Abort
  $GridView.CurrentCell.ImageIndex = -1
 Else
  $GridView.CurrentCell.ImageIndex = $Dialog1.ListView1.SelectedIndex
 EndIf

EndFunction

Function ColumnLockedClick()

 If $GridView.CurrentColumn.Index = -1
  Return
 EndIf

 $GridView.CurrentColumn.Locked = Not $GridView.CurrentColumn.Locked

 UpdateUI()

EndFunction

Function SelectionModeClick($mode)

 $GridView.SelectionMode = $mode

 UpdateUI()

EndFunction

Function AutoFormatClick($Theme)

 Select

  Case $Theme = 0 ; Default

   $GridView.AlternatingBackColor = -1
   $GridView.BackColor = -1
   $GridView.ForeColor = -1
   $GridView.GridLineColor = -1
   $GridView.Font = $Form.Font

  Case $Theme = 1 ; Professional1

   $GridView.AlternatingBackColor = -1
   $GridView.BackColor = "DarkGray"
   $GridView.ForeColor = "Black"
   $GridView.GridLineColor = "Black"
   $GridView.Font = $System.Font("Microsoft Sans Serif", 10)

  Case $Theme = 2 ; Professional2

   $GridView.AlternatingBackColor = -1
   $GridView.BackColor = "Silver"
   $GridView.ForeColor = "Black"
   $GridView.GridLineColor = "White"
   $GridView.Font = $System.Font("Microsoft Sans Serif", 10)

  Case $Theme = 3 ; Colorful1

   $GridView.AlternatingBackColor = -1
   $GridView.BackColor = "White"
   $GridView.ForeColor = "DarkSlateBlue"
   $GridView.GridLineColor = "Peru"
   $GridView.Font = $System.Font("Tahoma", 10)

  Case $Theme = 4 ; Colorful2

   $GridView.AlternatingBackColor = &0F7EBE7
   $GridView.BackColor = "White";"GhostWhite"
   $GridView.ForeColor = "Black" ;"MidnightBlue"
   $GridView.GridLineColor = &E7BE94 ;"RoyalBlue"
   $GridView.Font = $System.Font("Verdana", 8)

 EndSelect

EndFunction

Function GridLinesClick($style)

 $GridView.GridLines = $style
 UpdateUI()

EndFunction

Function LockedClick()

 $GridView.Locked = Not $GridView.Locked

 UpdateUI()

EndFunction

Function RowCountClick()

 Dim $InputBox

 $InputBox = $System.InputBox()
 $InputBox.Title = "RowCount"
 $InputBox.Prompt = "Enter RowCount ..."
 $InputBox.Default = "" + $GridView.RowCount

 $RowCount = Val($InputBox.Show())

 If $InputBox.DialogResult <> $System.DialogResult.OK
  Return
 EndIf

 $GridView.RowCount = $RowCount

 UpdateUI()

EndFunction

Function ResetColorsClick()

 If $GridView.CurrentColumn.Index <> -1
  $GridView.AlternatingBackColor = -1
  $GridView.BackColor = -1
  $GridView.ForeColor = -1
  $GridView.GridLineColor = -1
 EndIf

EndFunction

Function CellValueClick()

 Dim $InputBox, $Value

 $InputBox = $System.InputBox()
 $InputBox.Title = "Cell Value"
 $InputBox.Prompt = "Enter value:"
 $InputBox.Default = $GridView.CurrentCell.Value

 $Value = $InputBox.Show()

 If $InputBox.DialogResult <> $System.DialogResult.OK
  Return
 EndIf

 $GridView.CurrentCell.Value = $Value

 UpdateUI()

EndFunction

Function AboutClick()

 Dim $msg

 $msg = ""
 $msg = $msg + $TITLE + " " + $VERSION + @CRLF + @CRLF
 $msg = $msg + "Kixtart: " + @KIX + @CRLF
 $msg = $msg + "Kixforms: " + $System.Version + " Build: " + $System.Build

 $= $System.MessageBox.Show($msg, $TITLE,
   $System.MessageBoxButtons.Ok, $System.MessageBoxIcon.Information)

EndFunction

;; formatting functions ...

Function ColumnTitleClick()

 If $GridView.SelectedColumn

  $Title = $GridView.SelectedColumn.Text

  $Title = $System.InputBox.Show("New title...",$Title)

  If $Title
 
   $GridView.SelectedColumn.Text = $Title

  EndIf
 
 EndIf

EndFunction

Function ExitClick()

 Quit()

EndFunction

Function GridClearContentsClick($grid)

 For $i = 0 to $grid.ActiveSheet.RowCount - 1
  For $j = 0 to $grid.ActiveSheet.ColumnCount - 1
   $grid.ActiveSheet.Cells($i,$j).Value = Chr(0)
  Next
 Next

EndFunction

Function ValueTextBoxKeyDown()

 If $AddressBar.ValueTextBox.KeyCode <> 13
  Return
 EndIf

 $GridView.CurrentCell.Value = $AddressBar.ValueTextBox.Text
 $GridView.Focus()

 UpdateUI()

EndFunction

;
; EVENTS
;

Function CellValueChanged()

 UpdateUI()

EndFunction

Function CurrentCellChanged()

 UpdateUI()

EndFunction

Function CurrentRowChanged()

 UpdateUI()

EndFunction

Function CurrentColumnChanged()

 UpdateUI()

EndFunction

Function UpdateUI()

 If $GridView.CurrentColumn.Index <> -1

  $MainMenu.ColumnLockedMenu.Checked = $GridView.CurrentColumn.Locked

  $MainMenu.ColumnAlignmentLeftMenu.Checked = $GridView.CurrentColumn.Alignment = 1
  $MainMenu.ColumnAlignmentCenterMenu.Checked = $GridView.CurrentColumn.Alignment = 2
  $MainMenu.ColumnAlignmentRightMenu.Checked = $GridView.CurrentColumn.Alignment = 3
  $MainMenu.ColumnAlignmentGeneralMenu.Checked = $GridView.CurrentColumn.Alignment = 0

  $MainMenu.ColumnAutomaticCellTypeMenu.Checked = $GridView.CurrentColumn.CellType = 0
  $MainMenu.ColumnTextBoxCellTypeMenu.Checked = $GridView.CurrentColumn.CellType = 1
  $MainMenu.ColumnComboBoxCellTypeMenu.Checked = $GridView.CurrentColumn.CellType = 2
  $MainMenu.ColumnCheckBoxCellTypeMenu.Checked = $GridView.CurrentColumn.CellType = 3

  $MainMenu.ColumnNumberFormatMenu.Checked = $GridView.CurrentColumn.ValueType = 5
  $MainMenu.ColumnCurrencyFormatMenu.Checked = $GridView.CurrentColumn.ValueType = 6
  $MainMenu.ColumnDateTimeFormatMenu.Checked = $GridView.CurrentColumn.ValueType = 7
  $MainMenu.ColumnTextFormatMenu.Checked = $GridView.CurrentColumn.ValueType = 8
  $MainMenu.ColumnBooleanFormatMenu.Checked = $GridView.CurrentColumn.ValueType = 11
  $MainMenu.ColumnVariantFormatMenu.Checked = $GridView.CurrentColumn.ValueType = 12

 EndIf

 If $GridView.CurrentCell.RowIndex <> -1

  ;;$MainMenu.ColumnLockedMenu.Checked = $GridView.CurrentColumn.Locked

  ;$MainMenu.CellAlignmentLeftMenu.Checked = $GridView.CurrentCell.Alignment = 1
  ;$MainMenu.CellAlignmentCenterMenu.Checked = $GridView.CurrentCell.Alignment = 2
  ;$MainMenu.CellAlignmentRightMenu.Checked = $GridView.CurrentCell.Alignment = 3
  ;$MainMenu.CellAlignmentGeneralMenu.Checked = $GridView.CurrentCell.Alignment = 0

 EndIf

 $MainMenu.TablesViewMenu.Checked = $MainSplit.Panel1Collapsed = 1

 $MainMenu.AllowSortingMenu.Checked = $GridView.AllowSorting

 $MainMenu.ColumnHeaderStyleNoneMenu.Checked = $GridView.ColumnHeaderStyle = 0
 $MainMenu.ColumnHeaderStyleFlatMenu.Checked = $GridView.ColumnHeaderStyle = 1
 $MainMenu.ColumnHeaderStyleNormalMenu.Checked = $GridView.ColumnHeaderStyle = 2
 
 $MainMenu.GridLinesNoneMenu.Checked = $GridView.GridLines = 0
 $MainMenu.GridLinesHorizontalMenu.Checked = $GridView.GridLines = 1
 $MainMenu.GridLinesVerticalMenu.Checked = $GridView.GridLines = 2
 $MainMenu.GridLinesBothMenu.Checked = $GridView.GridLines = 3

 $MainMenu.LockedMenu.Checked = $GridView.Locked

 $MainMenu.SelectionModeCellSelectMenu.Checked = $GridView.SelectionMode = 0
 $MainMenu.SelectionModeFullRowSelectMenu.Checked = $GridView.SelectionMode = 1

 ;

 If $GridView.CurrentCell.RowIndex <> -1

  If VarTypeName($GridView.CurrentCell.Value) = "Empty"
   $StatusBar.TypeLabel.ForeColor = "Red"
  Else
   $StatusBar.TypeLabel.ForeColor = "Blue"
  EndIf

  $StatusBar.TypeLabel.Text = VarTypeName($GridView.CurrentCell.Value)

  $AddressBar.ValueTextBox.Text = $GridView.CurrentCell.Value

 EndIf

 $StatusBar.AddressLabel.Text = "R" + $GridView.CurrentRow.Index + "C" + $GridView.CurrentColumn.Index
   ;+ " (" + VarTypeName($GridView.CurrentCell.Value) + ")"

EndFunction

Function GridRenumberRows($grid)

 Return

 For $i = 0 to $grid.ActiveSheet.RowCount - 1
  $grid.ActiveSheet.Cells($i,0).Value = $i
 Next

EndFunction

Function ReadValueEx($Key, $Value, $Default)

 Dim $Data

 $ReadValueEx = $Default

 $Data = ReadValue($Key,$Value)
 If @ERROR = 0
  $ReadValueEx = $Data
 EndIf

EndFunction

;
;
;

Function ChooseColor($Color)

 Dim $cd

 $cd = $System.ColorDialog()

 $cd.Color = $Color

 $ChooseColor = $Color

 If $cd.ShowDialog() = $System.DialogResult.Ok

  $ChooseColor = $cd.Color

 EndIf

EndFunction

Function FormatColumnClick()

 Dim $Dialog, $Row

 $Dialog = Dialog($Form, 300,300)

 $Dialog.Text = "Format Column"

 $Dialog.PropertyView = $Dialog.TopPanel.GridView()
 $Dialog.PropertyView.Font = $System.Font("Verdana", 8.25)
 $Dialog.TopPanel.DockPadding = 5,5,5,5
 $Dialog.PropertyView.Dock = "Fill"

 $Dialog.PropertyView.ColumnCount = 3

 $Dialog.PropertyView.BorderStyle = 0
 $Dialog.PropertyView.ColumnHeaderStyle = 0
 $Dialog.PropertyView.FullRowSelect = 0

 $Dialog.PropertyView.Columns(0).BackColor = "Control"
 $Dialog.PropertyView.Columns(1).BackColor = "White"
 $Dialog.PropertyView.Columns(2).BackColor = "White"

 $Dialog.PropertyView.Columns(0).Width = 20
 $Dialog.PropertyView.Columns(1).Width = 0.40 * $Dialog.PropertyView.ClientWidth
 $Dialog.PropertyView.Columns(2).Width = $Dialog.PropertyView.ClientWidth -
      ($Dialog.PropertyView.Columns(0).Width +
      $Dialog.PropertyView.Columns(1).Width)

 $Dialog.PropertyView.Columns(0).Locked = 1
 $Dialog.PropertyView.Columns(1).Locked = 1
 $Dialog.PropertyView.Columns(2).Locked = 0

 $Column = $GridView.CurrentColumn

; $Row = $Dialog.PropertyView.Rows.Add()
; $Row.Cells(1).Text = "Property"
; $Row.Cells(1).BackColor = $Dialog.BackColor
; $Row.Cells(2).Text = "Value"
; $Row.Cells(2).BackColor = $Dialog.BackColor

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "Alignment"
 $Row.Cells(2).CellType = "ComboBox"
 $Row.Cells(2).Items.Add("0 - General", 0)
 $Row.Cells(2).Items.Add("1 - Left", 1)
 $Row.Cells(2).Items.Add("2 - Center", 2)
 $Row.Cells(2).Items.Add("3 - Right", 3)
 ;$Row.Cells(2).Items.Add("(Reset)", -1)
 $Row.Cells(2).Value = $Column.Alignment

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "BackColor"
 $Row.Cells(2).Value = $Column.BackColor

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "CellType"
 $Row.Cells(2).CellType = "Combobox"
 $Row.Cells(2).Items.Add("0 - TextBox", 0)
 $Row.Cells(2).Items.Add("1 - ComboBox", 1)
 $Row.Cells(2).Items.Add("2 - CheckBox", 2)
 $Row.Cells(2).Value = $Column.CellType

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "ForeColor"
 $Row.Cells(2).Value = $Column.ForeColor

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "Format"
 $Row.Cells(2).Value = $Column.Format

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "HeaderText"
 $Row.Cells(2).Value = $Column.Format

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "Items"
 $Row.Cells(2).Value = "Collection..."

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "Locked"
 $Row.Cells(2).CellType = "ComboBox"
 ;$Row.Cells(2).ValueType = "Boolean"
 $Row.Cells(2).Format = "True/False"
 $Row.Cells(2).Items.Add("True",-1)
 $Row.Cells(2).Items.Add("False",0)
 $Row.Cells(2).Value = $Column.Locked

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "TextAlign"
 $Row.Cells(2).Value = $Column.Alignment

 $Row = $Dialog.PropertyView.Rows.Add()
 $Row.Cells(1).Text = "ValueType"
 $Row.Cells(2).CellType = "ComboBox"
 ;$Row.Cells(2).Items = $System.ListItemCollection()
 $Row.Cells(2).Items.Add("Boolean", 11)
 $Row.Cells(2).Items.Add("Currency", 6)
 $Row.Cells(2).Items.Add("Date", 7)
 $Row.Cells(2).Items.Add("Number", 5)
 $Row.Cells(2).Items.Add("String", 8)
 $Row.Cells(2).Items.Add("Variant", 12)
 $Row.Cells(2).Items.Add("(Reset)", -1)
 $Row.Cells(2).Value = $Column.ValueType

 $Dialog.PropertyView.CurrentRow = 0
 $Dialog.PropertyView.CurrentColumn = 2
 $Dialog.PropertyView.Focus()
 
 $= $Dialog.ShowDialog()

 Return

EndFunction

;
; ADOTablePicker
;

Function AdoTablePicker($form, $fn)

 Dim $Dialog, $Connection, $Schema

 $Connection = CreateObject("ADODB.Connection")
 If @ERROR Return EndIf

 $= $Connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=$fn;")
 If @ERROR Return EndIf

 $Schema = $Connection.OpenSchema(20)
 If @ERROR Return EndIf

 $Dialog = Dialog($Form)

 $Dialog.Text = "Select Table"

 $Dialog.TableView = $Dialog.TopPanel.GridView()
 $Dialog.TableView.Dock = "Fill"
 $Dialog.TableView.FullRowSelect = 1
 $Dialog.TableView.Locked = 1
 $Dialog.TableView.GridLines = 0

 $Dialog.TableView.ColumnCount = 5

 $Dialog.TableView.Columns(0).HeaderText = "Name"
 $Dialog.TableView.Columns(1).HeaderText = "Description"
 $Dialog.TableView.Columns(2).HeaderText = "Type"
 $Dialog.TableView.Columns(3).HeaderText = "Modified"
 $Dialog.TableView.Columns(4).HeaderText = "Created"

 $Schema.MoveFirst

 $Dialog.TableView.BeginUpdate

 While Not $Schema.EOF

  If $Schema.Fields("TABLE_TYPE") = "TABLE"

   $Row = $Dialog.TableView.Rows.Add()
   $Row.Cells(0).Text = $Schema.Fields("TABLE_NAME")
   $Row.Cells(0).ImageIndex = 0
   $Row.Cells(1).Text = $Schema.Fields("DESCRIPTION")
   $Row.Cells(2).Text = $Schema.Fields("TABLE_TYPE")
   $Row.Cells(3).Text = $Schema.Fields("DATE_MODIFIED")
   $Row.Cells(4).Text = $Schema.Fields("DATE_CREATED")

  EndIf

  $Schema.MoveNext

 Loop

 $Dialog.TableView.EndUpdate

 $Dialog.TableView.Focus

 $Dialog.Center()

 $AdoTablePicker = ""

 If $Dialog.ShowDialog() = $System.DialogResult.Ok

  $AdoTablePicker = $Dialog.TableView.CurrentRow.Cells(0).Text

 EndIf

 $Schema = 0
 $Connection = 0

EndFunction

Function EditItems($Object)

 ; Edit the items collection of the specified object
 ; Object must have an "Items" property

 Dim $Dialog, $Items, $Item

 $Dialog = Dialog($Form, 500,400)
 $Dialog.Text = "ListItemCollection Editor"

 $Dialog.CaptionLabel = $Dialog.TopPanel.Label()
 $Dialog.CaptionLabel.Height = 30
 $Dialog.CaptionLabel.Dock = "Top"
 $Dialog.CaptionLabel.Text = "Enter the strings in the collection (one per line):"
 $Dialog.CaptionLabel.TextAlign = "MiddleLeft"

 $Dialog.ItemTextBox = $Dialog.TopPanel.TextBox()
 $Dialog.ItemTextBox.MultiLine = 1
 $Dialog.ItemTextBox.BorderStyle = 1
 $Dialog.ItemTextBox.Dock = "Fill"

 If VarType($Object.Items) = 9
  For Each $Item in $Object.Items
   $Dialog.ItemTextBox.AppendText($Item.Text + @CRLF)
  Next
 EndIf

 $Dialog.Center()
 $Dialog.ItemTextBox.Focus()

 If $Dialog.ShowDialog() <> $System.DialogResult.Ok
  Return
 EndIf

 If Len($Dialog.ItemTextBox.Text)
  $Items = $System.ListItemCollection()
  For Each $Item in Split($Dialog.ItemTextBox.Text,@CRLF)
   If $Item
    $Items.Add($Item)
   EndIf
  Next
  $Object.Items = $Items
 Else
  $Object.Items = 0
 EndIf

EndFunction

;
; DIALOG
;

Function Dialog($Form, Optional $ClientWidth, Optional $ClientHeight)

 ;; Creates standard (template) dialog form...

 If VarType($ClientWidth) = 0
  $ClientWidth = 500
 EndIf

 If VarType($ClientHeight) = 0
  $ClientHeight = 300
 EndIf

 $Dialog = $System.Form($Form)
 $Dialog.MinimizeBox = 0
 $Dialog.MaximizeBox = 0
 $Dialog.Text = "Dialog"
 $Dialog.FormBorderStyle = 3
 $Dialog.Font = $Form.Font; $System.Font("Verdana",10)
 $Dialog.ClientSize = $ClientWidth, $ClientHeight

 $Dialog.BottomPanel = $Dialog.Panel()
 $Dialog.BottomPanel.Height = 35
 $Dialog.BottomPanel.Dock = "Bottom"
 $Dialog.BottomPanel.DockPadding = 4

 $Dialog.OkButton = $Dialog.BottomPanel.Button()
 $Dialog.OkButton.Text = "OK"
 $Dialog.OkButton.Size = 75,25
 $Dialog.OkButton.DialogResult = $System.DialogResult.OK

 $Dialog.CancelButton = $Dialog.BottomPanel.Button()
 $Dialog.CancelButton.Text = "Cancel"
 $Dialog.CancelButton.DialogResult = $System.DialogResult.Cancel
 $Dialog.CancelButton.Size = 75,25

 $Dialog.CancelButton.Dock = "right"
 $Dialog.OkButton.Dock = "right"

 $Dialog.TopPanel = $Dialog.Panel()
 $Dialog.TopPanel.Dock = "Fill"

EndFunction

Function ReportError($msg, $error, $serror)

 Dim $MessageBox

 $MessageBox = $System.MessageBox()

 $MessageBox.Title = "Error"

 $= $MessageBox.Show($serror)

 Exit $error

EndFunction


Shawn, any thoughts?

_________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)
Back to top
View user's profile Send private message Send e-mail
Chad
KiXforms Novice
KiXforms Novice


Joined: 20 Nov 2008
Posts: 4

PostPosted: Sat May 30, 2009 9:37 am    Post subject: Reply with quote

Through a combination of brute force and ignorance(!) I think I've found the answer. I looked through the typelib viewer and tried every combination I could think of that sounded plausible.

Finally:

$GridView.Rows.RemoveAt($row)

Did the trick. Looks like syntax changed somewhere along the line.

Let me know if it works for you.

Cheers!

Chad

[Edit] - As mentioned elsewhere, it can be useful to execute:
$GridView.CurrentRowIndex = $GridView.CurrentRowIndex
after the remove - this ensures that the selected cell appears "highlighted" on the (new) current row once the previous one is deleted. Without it, another call to your remove row function without first clicking in the grid will indeed remove another row, but it's not immediately obvious which one it will remove Wink Try it with and without and you'll see what I mean.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group