This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ToTranslitDoc() | |
Dim i As Long | |
Dim oMerge As MailMerge | |
Dim oData As MailMergeDataSource | |
Set oMerge = ActiveDocument.MailMerge | |
Set oData = oMerge.DataSource | |
Application.ScreenUpdating = False | |
For i = 1 To oData.RecordCount |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string newDeal = inputTextBox.Text; | |
newDeal = newDeal.Substring(0, 1).ToUpper() + (newDeal.Length > 1 ? newDeal.Substring(1) : ""); //делаем первую букву заглавной |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
//if (e.KeyChar == (char)Keys.Enter) return; //Enter | |
//if (e.KeyChar == (char)Keys.Back) return; //Backspace | |
/* Правильными символами считаются только | |
* цифры, точка (не более одной а все запятые заменяем точками), | |
* <Enter>, <Backspace>*/ | |
if (e.KeyChar >= '0' && e.KeyChar <= '9') return; //цифра | |
if (Char.IsControl(e.KeyChar)) return; //<Enter>, <Backspace>, <Esc> | |
if (e.KeyChar == ',') e.KeyChar = '.'; //заменяем запятую точкой |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Cheked items to string: | |
string result = CheckedItemsToString(checkedListBox1.CheckedItems) | |
public static string CheckedItemsToString(CheckedListBox.CheckedItemCollection input) | |
{ | |
List<string> values = new List<string>(); | |
foreach (object o in input) | |
values.Add(o.ToString()); | |
return String.Join(",\n", values); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dateTimePicker1.Value = DateTime.Now.AddDays(-DateTime.Now.DayOfYear + 1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void печатьToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
try | |
{ | |
Reader = new System.IO.StreamReader(openFileDialog1.FileName, System.Text.Encoding.GetEncoding(1251)); | |
try { printDocument1.Print(); } | |
finally { Reader.Close(); } | |
} | |
catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Form1_MouseDown(object sender, MouseEventArgs e) | |
{ | |
// если нажата левая кнопка мыши | |
if (e.Button == MouseButtons.Left) | |
{ | |
moveStart = new Point(e.X, e.Y); | |
} | |
} | |
private void Form1_MouseMove(object sender, MouseEventArgs e) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.IO.StreamReader Reader; | |
Создание потока среамреадер для чтения из файла | |
Reader = new System.IO.StreamReader(openFileDialog1.FileName, System.Text.Encoding.GetEncoding(1251)); | |
textBox1.Text = Reader.ReadToEnd(); Reader.Close(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) // нажатие кнопки в поле редактирования | |
{ | |
if ((e.KeyChar >= '0') && (e.KeyChar <= '9')) //разрешение цифр от 0 до 9 | |
return; | |
// в поле редактирование не может быть больше одной точки если вводят запятую меняем ее на точку | |
if (e.KeyChar == ',') e.KeyChar = '.'; | |
if (e.KeyChar == '.') | |
// точка не может быть первым символом | |
{ if((textBox1.Text.IndexOf('.') != -1) || (textBox1.TextLength == 0)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//В WPF обход всех RadioButton в StackPanel radioStack | |
foreach (UIElement c in radioStack.Children) { | |
if (c is RadioButton) | |
((RadioButton)c).IsChecked = false; | |
} | |
//Пример обхода всех TextBox-ов | |
foreach (Control control in Controls) | |
{ | |
TextBox tb = control as TextBox; |