How to transfer a path from TextBox to another class to the path variable?
public partial class Form1 : Form { private void button2_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Выберите файл"; ofd.Filter = "Текстовые файлы|*.txt"; if (ofd.ShowDialog() == DialogResult.OK) textBox1.Text = ofd.FileName; } } public class text { public void SplitAndQuery() { string path = @"D:\text\text.txt"; char[] separatorLines = { '\n' }; char[] separatorWords = { ';' }; string[] lines = File.ReadAllText(path, Encoding.Default).Split(separatorLines, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i <= lines.Length - 1; i++) { //code } } } 