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
//Если находится на форме | |
(Controls["textBox1"] as TextBox).Text = "newText"; | |
//если находится в груп боксе | |
groupBox1.Controls["comboBox2"] as ComboBox).Text = "newText"; |
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 | |
private void Button_Click(object sender, RoutedEventArgs e) | |
{ | |
newWindow nw = new newWindow(); | |
nw.ShowDialog(); | |
} | |
//В Windows Forms | |
private void button1_Click(object sender, EventArgs 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
private void Form1_FormClosing(object sender, FormClosingEventArgs e) | |
{ | |
// Обработка момента закрытия формы | |
if (richTextBox1.Modified == false) return; | |
// Если текст модифицирован выясняем записывать ли файл | |
var MBox = MessageBox.Show("Текст был изменен\n" + "Сохранить изменения?", "Простой редактор", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation); | |
if (MBox == DialogResult.No) return; | |
if (MBox == DialogResult.Cancel) e.Cancel = true; | |
if (MBox == DialogResult.Yes) | |
{ |
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 | |
//В xaml | |
<TextBox InputLanguageManager.InputLanguage="ru-RU" /> | |
//В коде | |
InputLanguageManager.SetInputLanguage(inputTextBox, CultureInfo.CreateSpecificCulture("ru-RU")); | |
//В Windows Form | |
InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(System.Globalization.CultureInfo.CreateSpecificCulture("Ru")); |
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; | |
using System.IO; | |
using System.Text; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string readPath = @"D:\read.txt"; //путь для чтения файла | |
string writePath = @"D:\write.txt"; //пусть для записи файла |
NewerOlder