Prevent users from resizing the window/form size
Change FormBorderStyle to FixedDialog, FixedSingle, or Fixed3D. Also, if you do not want them to maximize the form set Maximize to False.
Change FormBorderStyle to FixedDialog, FixedSingle, or Fixed3D. Also, if you do not want them to maximize the form set Maximize to False.
Solution very easy; Just add this on top of the Main method [STAThread] So your main method should look like this [STAThread] static void Main(string[] args) { …. } It works for me.
Pretty old question. Wonder why anyone hasn’t answered it till now. OK, I’ll try and share things from my experience. A BindingSource is more than just a way to bind controls to collections. After having worked in WinForms for over a decade, the best features of a BindingSource that I like the most include: Binding … Read more
Panel and other similar controls have both Margin and Padding properties. Padding determines spacing internal to the control …such as a panel. If Padding is set to 3 (All) in a Panel control, then controls will snap to 3 pixels of padding against internal edges of the control. Margin works the same way, but between … Read more
No, a StringBuilder is a purely managed resource. You should just get rid of all references to it. Everything else is taken care of by the garbage collector: StringBuilder sb = …; // … do work sb = null; // or simply let it go out of scope. In .NET, there’s no deterministic delete (like … Read more
Consider using the Clipboard class. It features all the methods necessary for putting data on the Windows clipboard and to retrieve data from the Windows clipboard. StringCollection paths = new StringCollection(); paths.Add(“f:\\temp\\test.txt”); paths.Add(“f:\\temp\\test2.txt”); Clipboard.SetFileDropList(paths); The code above will put the files test.txt and test2.txt for copy on the Windows Clipboard. After executing the code you … Read more
You don’t actually interact directly with the scrollbar, rather you set the FirstDisplayedScrollingRowIndex. So before it reloads, capture that index, once it’s reloaded, reset it to that index. EDIT: Good point in the comment. If you’re using a DataGridView then this will work. If you’re using the old DataGrid then the easiest way to do … Read more
DownloadButton.Enabled = false;
I needed this functionality also. I made a class that inherits PictureBox, overrides OnPaint and adds a property to allow the interpolation mode to be set: using System.Drawing.Drawing2D; using System.Windows.Forms; /// <summary> /// Inherits from PictureBox; adds Interpolation Mode Setting /// </summary> public class PictureBoxWithInterpolationMode : PictureBox { public InterpolationMode InterpolationMode { get; set; } … Read more
This did the trick for me: USE <DATABASE>; EXEC sp_configure ‘clr enabled’ ,1 GO RECONFIGURE GO EXEC sp_configure ‘clr enabled’ — make sure it took GO USE <DATABASE> GO EXEC sp_changedbowner ‘sa’ USE <DATABASE> GO ALTER DATABASE <DATABASE> SET TRUSTWORTHY ON;