Skip to main content

Posts

Showing posts with the label VB.NET

Type equal sign in Excel without evaluating

Typing equal sign in Excel will trigger Excel to evaluate the contents or the formula that is being typed.
But how to type equal sign plus the contents without evaluating the formula?


Or how to display a formula in a cell using Excel?
In VBA, Excel Macro, VBscript and VB.Net; to put comments or remarks on the code is to use single quote.
A single quote tells the engine that whatever that follows from the quote is a string and not a command and should not be evaluated.
In this way, you can type anything after the single quote “ “.
So, this goes the same way in the Excel interface.
If you want just to show the formula for remarks or whatever purposes but don’t want Excel to evaluate the contents, then just type a single quote before the equal sign or the formula.
Example: ‘=1+1
Excel will just display =1+1 It will be treated as a literal string. Of course, without the single quote then the result will be displayed.
See image below:



That’s it, you can use a single quote to treat formu…

PowerShell get Printer Name and Driver path

Descriptive Printer name is quite useful especially if managing quite a few printers on a network. Knowing the driver path of the printers is also useful, the file can be copied and can be used to install on another computer if necessary.
Here’s the PowerShell code:

Get-WmiObject-Query"Select DriverPath, Name from Win32_printerdriver"-Namespace'Root\CIMV2'|SelectName,DriverPath|ft-wrap
Sample Output:

Cheers..till next time. :)


================================ Free Android Apps:
Click  links below to find out more:
Excel Keyboard guide: https://play.google.com/store/apps/details?id=chrisjoms.myexcelapplicationguide

Heaven's Dew Fall  Prayer app for Android :
https://play.google.com/store/apps/details?id=soulrefresh.beautiful.prayer
Catholic Rosary Guide  for Android:
https://play.google.com/store/apps/details?id=com.myrosaryapp
http://quickbytesstuff.blogspot.sg/2014/09/how-to-recite-rosary.html

PowerShell GUI with buttons, textbox and combobox

GUI makes life easier, but of course command line has a power of its own.
How to add a form in PowerShell with Buttons, TextBox and ComboBox?
Adding GUI forms in PowerShell must be done manually by code.
It’s not that hard, you just need to love PowerShell and see what it can do to automate IT administration and makes your life easier.
Anyway, code below introduces how to add GUI to PowerShell and it also illustrates how to make use of those GUI buttons and send a command to remote computers.
Code to add buttons, textbox and combobox in PowerShell, and how to execute a command after the button is clicked.
#initialize the main form $form=new-objectWindows.forms.form $form.text ="Server Selection Form"
$form.minimumSize =New-ObjectSystem.Drawing.Size(600,300) $form.maximumSize =New-ObjectSystem.Drawing.Size(600,300)
#add a button to the form $button=new-objectwindows.forms.button $button.text ="Close Me"
#action that the button will execute after it has been clicked

List lnk or shortcut files in Windows with PowerShell

Link files or files with .lnk extension is also called shortcut files in Windows and is quite handy when accessing files, documents, or application programs when it is placed on a location where you needed it most. So you don’t have to browse all the way to the location of the file, instead just click the shortcut and the file or program will be opened.
As time goes by, shortcut files or .lnk files can easily be forgotten or sometimes it will just clutter on the desktop or in any sub folders in the computer.
How to list or get all shortcut files in Windows? Or aka how to get all .lnk files on the system?
PowerShell can easily list all the lnk or shortcut files, and determine when was the last time the shortcut link was used or modified.
Here’s the code using PowerShell on how to check all the ‘.lnk’ files on the system, Windows shortcuts has an extension of “.lnk” and its actual properties points to the location or path of the file.
PowerShell one-liner code to get all lnk files.
Get-CimIns…