vb.net

Running powershell in VB.NET - how to access the content of my variable

不想你离开。 提交于 2021-02-11 12:38:04
问题 I am running a simple script in VB using System.Management.Automation as below Script runs fine, but how do I then access content of $offline and $online in my code after it has run? Dim scriptContents = New StringBuilder() scriptContents.AppendLine("$computers = @(""PC-1"", ""PC-2"", ""PC-3"")") scriptContents.AppendLine("$online = @()") scriptContents.AppendLine("$offline = @()") scriptContents.AppendLine("Foreach ($computer in $computers) {") scriptContents.AppendLine("If (Test-Connection

DataGridComboBoxCell - Can't Fill Values Programmatically

邮差的信 提交于 2021-02-11 12:36:01
问题 I'm filling a DataGridView with 2 columns, a DataGridViewTextBoxColumn for a name label, and a DataGridViewComboBoxColumn to act as a dropdown for selecting an SQL Column name to map to the name. I'm going for a loop through my names, and creating a row for each of them. Each row should display the name of a field ( String object), and in the other column should be a combo box (values are within a List (Of String) ). I keep getting an exception raised that says 'the value is not valid': For

Visual Basic Shell Administrator?

丶灬走出姿态 提交于 2021-02-11 12:35:11
问题 If I'm using Visual Basic to run an executable using the Shell() command, how would I run that executable as an administrator? My method works, at least in practice, but one executable won't run properly and I think that's the issue. Here's an example of the command I'm trying to run. Shell("%temp%\ninite.exe") Edit: Sorry, this is VB.net, not VBA. I put a bad tag on there. 回答1: To stay strictly in VBA with no .NET dependencies, you should be able to use the ShellExecute Win32 function.

ASP.NET(VB) Listboxes are not moving all the selected items to other Listboxes

自古美人都是妖i 提交于 2021-02-11 12:35:10
问题 The DivisionListBox is used to select values in the SitesListbox as follows: When you select an item in the DivisionListBox it will select all the items on SitesListbox that match the same value. Once the SiteListbox values are selected I use the SiteButton to move all selected values to the empty StoreslistBox successfully. My problem happens when I manually select multiple items on either SiteListbox or StoreslistBox and press SiteButton or StoreButton to move items between Listboxes. It

Visual Basic Shell Administrator?

五迷三道 提交于 2021-02-11 12:35:05
问题 If I'm using Visual Basic to run an executable using the Shell() command, how would I run that executable as an administrator? My method works, at least in practice, but one executable won't run properly and I think that's the issue. Here's an example of the command I'm trying to run. Shell("%temp%\ninite.exe") Edit: Sorry, this is VB.net, not VBA. I put a bad tag on there. 回答1: To stay strictly in VBA with no .NET dependencies, you should be able to use the ShellExecute Win32 function.

Single Instance using Mutex in NET

眉间皱痕 提交于 2021-02-11 12:32:04
问题 How to make vb Form a single instance use Mutex. For the developers! Hi, I searched in the net how to make a single instance startup form in VB Net not in c# code. Here is my solution: In the project select "Add class..." Rename the new class in "NativeMethods.vb" and put this code: Add this reference: Imports System.Runtime.InteropServices Public Const HWND_BROADCAST As Integer = &HFFFF Public Shared ReadOnly WM_SHOWME As Integer = RegisterWindowMessage("WM_SHOWME") <DllImport("user32")>

How to show all the threads or instances of excel file in vb dot net.I want to show all the threads and one main process of excel files

落花浮王杯 提交于 2021-02-11 12:22:40
问题 How can I show all the threads or instances of Excel file in vb dot net? I want to show all the threads and one main process of Excel files. I have seen the process and process id but not a way to show all threads of Excel, meaning if I open three Excel files I can show three files in listbox. 回答1: I am not sure there is an easy way to do this. Here is some code that I have modified from a similar situation. Firstly here is a class that gets the child window titles from a specified process id

How do I make Internet Explorer driver invisible using Selenium and VB?

末鹿安然 提交于 2021-02-11 12:20:48
问题 I am using Selenium WebDriver to make some automations, using chrome I can use the headless argument to hide it, but I don't know the argument to hide the Internet Explorer. Dim driver As New ChromeDriver driver.AddArgument ("headless") Dim driver As New IEDriver driver.AddArgument ("?????????????????????") Library used - A Selenium based browser automation framework for VB.Net, VBA and VBScript 回答1: Based on my searching results, it looks like Internet Explorer does not support Headless mode

How to draw control while is moved in a Drag-and-drop event

时间秒杀一切 提交于 2021-02-11 10:02:30
问题 In Vb.net, through Drag and Drop events, a control (button) is moved from a Panel to another Panel. Is there any way or option to draw the control (button) while is being moved by cursor? Now I have only reached to change cursor shape, and when the action of Drag and Drop is finished, the control is drawn in its new panel parent. Thanks in advance. Edit: Added code public Sub New() InitializeComponent() '…. Panel1.AllowDrop = True Panel2.AllowDrop = True AddHandler Panel1.DragEnter, AddressOf

Why do these DLLs have two apparently identical entry points?

非 Y 不嫁゛ 提交于 2021-02-11 07:58:39
问题 Today, working on some VB.NET code I had to access two external DLLs in order to use some methods. The help topics that I found told me to use the following external methods: shlwapi.dll → PathIsNetworkPath (Reference 1) mpr.dll → WNetAddConnection2 and WNetCancelConnection2 (Reference 2) However, when I tried to call these methods from my code, I got an error saying that the entry point did not exist. So I did some research and I found out that the DLLs in my operative System (Windows 7