A
A
Anonymous Anonymous2020-04-09 17:48:00
Parsing
Anonymous Anonymous, 2020-04-09 17:48:00

How to take textBox value and pass it to a function?

Wrote a parser to get text from the site. There are two functions that get the number of the first page and the last page and they work just fine. The problem is that I am writing a new function for parsing Wikipedia, for example, and the parameter to the function is string. Tell me how you can use textBox.Text to transfer the text to the function.

private void textBoxWiki_TextChanged(object sender, EventArgs e)
        {
            string link = textBoxWiki.Text;
           
        }

        private void buttonWiki_Click(object sender, EventArgs e)
        {
            parser_wiki.Settings = new WikiSettings((string)link);
            parser_wiki.Start();
        }
//---------------------------------------------------------
namespace SuperParser.Core.Wiki
{
    class WikiSettings : SParserSettings
    {
        public WikiSettings(string link)
        {
            GetLink = link;
        }

        public string BaseUrl { get; set; } = "https://en.wikipedia.org/wiki/"; //здесь прописываем url сайта.
        public string Postfix { get; set; } = "search"; //вместо search будет подставляться строка из textBox
        public string GetLink { get; set; }
    }
}
//---------------------------------------------------------------------------

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-04-09
@King_Of_Demons

So you can always create your own variable in the class and store it there.
But in general

parser_wiki.Settings = new WikiSettings(textBoxWiki.Text);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question