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
//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
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
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
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
using System.IO; | |
public static bool CheckBd() { | |
string curDir = Directory.GetCurrentDirectory(); | |
FileInfo fileInf = new FileInfo(curDir + "/store.mdb"); | |
if (fileInf.Exists) return true; | |
return false; | |
} |
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
DockPanel> | |
<Menu DockPanel.Dock="Top" MinHeight="25"> | |
<MenuItem Header="File" /> | |
<MenuItem Header="Edit"> | |
<MenuItem Header="Copy" Command="Copy" CommandTarget="{Binding ElementName=tb1}" /> | |
<MenuItem Header="Paste" Command="Paste" CommandTarget="{Binding ElementName=tb1}" /> | |
</MenuItem> | |
</Menu> | |
<TextBox x:Name="tb1" DockPanel.Dock="Bottom" /> | |
</DockPanel> |
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
//Создаем класс | |
using System.Windows.Input; | |
namespace WPFWeekReport { | |
public class Commands { | |
static Commands() { | |
Save = new RoutedCommand("Save", typeof(MainWindow)); | |
} | |
public static RoutedCommand Save { get; set; } | |
} |
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
//Содежимое App.xaml | |
<Application.Resources> | |
<ResourceDictionary> | |
<ResourceDictionary.MergedDictionaries> | |
<ResourceDictionary Source="/WpfApp;component/styles/myButton.xaml"/> | |
</ResourceDictionary.MergedDictionaries> | |
</ResourceDictionary> | |
</Application.Resources> | |
//Навание сборки WpfApp, файл со стилем кнопки лежит в папке styles и называетмя myButton.xaml |
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
//Сначала добавляем сылку на Microsoft.Office.Interop.Excel; | |
using System; | |
using System.Collections.Generic; | |
using System.Windows; | |
using Excel = Microsoft.Office.Interop.Excel; | |