How-to Drag and Drop from a DataGridView to a ListBox
i would like know how can drag data datagridview listbox. see alot of examples dragging files explorer listbox in powershell script, cannot find example drag , drop between 2 powershell objects.
i have seen vb examples, cannot translate them powershell (i have never programmed in vb).
the code below example, of want.
regard,
marco
#region defineform #define form1 $form1 = new-object system.windows.forms.form $form1.text = "form1" $form1.name = "form1" $form1.databindings.defaultdatasourceupdatemode = 0 $form1.location = new-object system.drawing.point(1,1) $form1.windowstate = "normal" $form1.startposition = "centerscreen" $form1.autosize = $true $form1.autosizemode = "growandshrink" #endregion defineform #region grid1 #define table $datagridview1 = new-object system.windows.forms.datagridview $datagridview1.allowusertoaddrows = $false $datagridview1.allowusertodeleterows = $false $datagridview1.top = 1 $datagridview1.left = 1 $datagridview1.height = 100 $datagridview1.width = 210 $datagridview1.columnheadersvisible = $true $datagridview1.columnheadersheight = 20 #add columns $column1 = new-object system.windows.forms.datagridviewtextboxcolumn $column1.width = 150 $column1.name = 'servername' $datagridview1.columns.add($column1) $datagridview1.rows.add('server1') $datagridview1.rows.add('server2') $form1.controls.addrange(($datagridview1)) #endregion grid1 #region listbox1 #objlabel_clustername $objlabel1 = new-object system.windows.forms.label $objlabel1.location = new-object system.drawing.point(1,150) $objlabel1.size = new-object system.drawing.size(100,20) $objlabel1.text = "servername" $form1.controls.add($objlabel1) $objlistbox1 = new-object system.windows.forms.listbox $objlistbox1.location = new-object system.drawing.point(130,150) $objlistbox1.size = new-object system.drawing.size(130,20) $objlistbox1.allowdrop = $true $form1.controls.add($objlistbox1) #endregion listbox1 #region startform #start form $form1.showdialog() #endregion startform
datagridview not support drag/drop. can copy/paste 1 cell @ time.
\_(ツ)_/
Windows Server > Windows PowerShell
Comments
Post a Comment