Always thought that .NET in System.IO had a method that implements folder copying with contents, including all subfolders and files. It turned out I was wrong, and there is no such method. Therefore, I bring an example of implementing this action using a fairly simple function with the help of System.IO.DirectoryInfo.
Adding Records to a Table Ignoring IDENTITY: -- Enable SET IDENTITY_INSERT tableA ON -- You must specify the full list of columns for INSERT: INSERT Into tableA ([id], [c2], [c3], [c4], [c5] ) SELECT [id], [c2], [c3], [c4], [c5] FROM tableB...
Команды манипулирования данными SELECT , UPDATE , DELETE работают сразу с группами строк. Эти группы, вплоть до отдельных строк, можно выбрать с помощью опции WHERE. А если надо перебрать строки некоторой таблицы последовательно, одну за др…
From the archive... Recently, I had to make a simple image cropping tool, so that the user could manually select an area on the source image and cut it out. In principle, nothing complicated, the most difficult thing is probably drawing the selection rectangle when you click the mouse button and move it over the image - highlighting the necessary area.<br><br>First, the most important thing. On the image <b>pictureBox</b> immediately set the <b>SizeMode</b> property to <i>AutoSize</i>, without any <i>Zoom-ы</i> if you don't want to deal with scaling.<br><br>Next - we need to make it work so that scrolling works when selecting with the mouse. It just so happened that this is a painful place in .NET (it doesn't work on its own, and that's it).<br><br>To make it work, do this:
XML File Processing Example in C#. A simple example that clearly shows how easy it is to break down an XML file into pieces.
From the archive I will tell you about one small nuance that will help save time and nerves. This feature was noticed by me only in MySQL (manifested both in 5 and currently in the test 6th). It is about the need for a special naming of procedures for proper recovery of the database from the MySQL archive (dump).
Here I will provide some very useful things when developing on .NET Compact Framework. So, let's get started: Learn the version of .NET Compact Framework FrmTxt.Text = Environment.Version.ToString(); Learn the version of the operating system OsVersion.Text =…
From the archive - might come in handy... It seems there's nothing simpler than opening an image from disk in C#. But, there are some pitfalls! Here are two examples. The first method (incorrect): if (openFileDialog1.ShowDialog() == DialogResult.OK) {…
From the archive - might come in handy... Often when adding images to a project, you need to change the image size, and often you want to do it properly, with the image proportions preserved. Personally, I often need to insert images into a ListView and shrink them correctly (so they don't spread out in a square of the specified size). This is exactly where the procedure below will help. <br><br>Size change procedure:
To allow only digits to be entered in a TextBox field in C#, the simplest way is to use a KeyPress event handler. Here is how to do it: private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (!(Char.IsDigit…