Posts

Showing posts with the label winforms

Need to create, use and store dynamic object names in Powershell

Need to create, use and store dynamic object names in Powershell I am loading in a text file and looping through each line, and trying to print a checkbox, in a powershell form. However, the way below, all checkboxes have the same variable/object name, which makes it impossible to tell them apart. I need a way to dynamically create $checkbox0 through $checkbox(# of lines in text file, which can change), and fill them in below, as well as store the names, so i can validate if they are clicked later $pFile = Get-Content "C:results.txt" $rowCounter = 0 foreach($line in $pFile){ $checkbox = New-Object System.Windows.Forms.CheckBox $checkbox.UseVisualStyleBackColor = $True $System_Drawing_Size = New-Object System.Drawing.Size $checkbox.AutoSize = "true" $checkbox.TabIndex = $rowCounter $checkbox.Text = $line $System_Drawing_Point = New-Object System.Drawing.Point $System_Drawing_Point.X = 25 $yValue = (20 * $rowCounter) $System_Dra...

Index was outside the bounds of the array. VB

Index was outside the bounds of the array. VB I have been trying to create a program that will find the word the user has clicked on, in a multiline textbox. This procedure is based on the index from the position of the click. The code I implemented: Public Class Form1 Private Sub TextBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseDown If e.Clicks = 1 And e.Button = MouseButtons.Left Then 'Try Dim indexClicked As Integer = TextBox1.GetCharIndexFromPosition(New Point(e.X, e.Y)) Dim ch As Char = TextBox1.Text.Chars(indexClicked) Dim indexOfWord As Int32 If Not ch = " " Then Dim wordFound As Boolean Dim previousCh As Char Dim previousIndex As Integer = indexClicked While Not wordFound previousIndex = previousIndex - 1 previousCh = TextBox1.Text.Chars(previousIndex) If previousCh = " " Then ...

Prevent user from closing Selenium-driven Firefox

Prevent user from closing Selenium-driven Firefox While running a Selenium-driven session of Firefox, can I prevent user from closing browser's window, or, at least, subjecting it to a confirmation so that they can avoid doing so by accident? I'm using Selenim with Winforms VB.NET application, on Windows. Did you try running it in headless mode? stackoverflow.com/questions/35818436/… – Jason Bayldon Jul 1 at 21:53 User must perform login using a digital certificate token before the automated part kicks in, so I don't think headless would be an option for me... But thanks anyway. – VBobCat Jul 2 at 12:37 By clicking ...