Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question