1.SetClipboardViewer
Imports System.Runtime.InteropServices
Public Class Form1
Private hwndNextChain As IntPtr
Public Sub New()
using System; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using System.Runtime.Remoting; | |
using System.Runtime.Remoting.Messaging; | |
using System.Runtime.Remoting.Proxies; | |
using System.Diagnostics; | |
static class UTL | |
{ |
1.SetClipboardViewer
Imports System.Runtime.InteropServices
Public Class Form1
Private hwndNextChain As IntPtr
Public Sub New()
Would you like to try using NetOfficeFw.Excel? You can get it from nuget.
https://www.nuget.org/packages/NetOfficeFw.Excel
There is no need to write Marshal.ReleaseComObject at all. All objects implement IDisposable, and when you Dispose them, they are released internally using ReleaseComObject. Also, if you Dispose the top level NetOffice.ExcelApi.Application, all the objects under it will be released.
Since it is late binding, it does not depend on the Office version.
Imports System.Collections | |
Imports System.Collections.Generic | |
Imports System.ComponentModel | |
Imports System.Runtime.InteropServices | |
Imports System.Windows.Forms | |
<DefaultEvent("HotkeyPress")> | |
Public Class Hotkey | |
Inherits Component |
Imports System.ComponentModel | |
Imports System.Runtime.InteropServices | |
Imports System.Windows.Forms | |
<DesignerCategory("code")> | |
<DefaultEvent("KeyDown")> | |
Public Class LowLevelKeyboardHook | |
Inherits Component | |
Private HookHandle As IntPtr = IntPtr.Zero |
Option Strict On | |
Imports System | |
Imports System.Diagnostics | |
Imports System.Runtime.InteropServices | |
Imports System.Text | |
Imports System.Windows.Forms | |
Public Class RestrictText | |
Inherits TextBox | |
Private Const CTRL_A As Char = ChrW(&H1) ' CTRL+A (Select All) |
using System; | |
using System.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
using System.Windows.Forms; | |
public class RestrictText : TextBox | |
{ | |
private const char BACKSPACE = '\b'; // Backspace | |
private const char CTRL_A = '\x01'; // CTRL+A(Select All) |
How to pass a ref string from C# to a DLL
C#
[DllImport("SampleDLL.Dll", CharSet = CharSet.None)]
[return: MarshalAs(UnmanagedType.BStr)]
extern public static string StringTest(
[MarshalAs(UnmanagedType.BStr)] ref string refString
);
using System; | |
using System.Drawing; | |
using System.Windows.Forms; | |
using System.Windows.Forms.VisualStyles; | |
public class DataGridViewSelectAllCheckBoxHeaderCell : DataGridViewColumnHeaderCell | |
{ | |
protected static class CheckBoxHeaderCellRenderer | |
{ | |
private static readonly VisualStyleElement CheckBoxElement |