Click here to Skip to main content
15,892,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: Custom control not visible on parent control Pin
Luc Pattyn28-Jul-18 13:17
sitebuilderLuc Pattyn28-Jul-18 13:17 
AnswerRe: Custom control not visible on parent control Pin
OriginalGriff28-Jul-18 20:24
mveOriginalGriff28-Jul-18 20:24 
AnswerRe: Custom control not visible on parent control Pin
Gerry Schmitz31-Jul-18 13:19
mveGerry Schmitz31-Jul-18 13:19 
Questionread text file online c# Pin
Luiz Carlos27-Jul-18 9:40
Luiz Carlos27-Jul-18 9:40 
AnswerRe: read text file online c# Pin
Dave Kreskowiak27-Jul-18 13:47
mveDave Kreskowiak27-Jul-18 13:47 
AnswerRe: read text file online c# Pin
OriginalGriff27-Jul-18 20:19
mveOriginalGriff27-Jul-18 20:19 
GeneralRe: read text file online c# Pin
Gerry Schmitz28-Jul-18 8:00
mveGerry Schmitz28-Jul-18 8:00 
QuestionGetting first paragraph of wikipedia using Voice C# Pin
Wishingchain26-Jul-18 20:58
Wishingchain26-Jul-18 20:58 
Hi, My name is Wish and I have recently coded an application that recognizes commands I ask it to do(open notepad, gives time, etc.) I now want to be able to ask it a question like "who is Barack Obama" and it will respond with the first paragraph of the wikipedia article.
I have this code so far which requires me to manually type in what I want to search for.
This is that code

C#
<pre>  var webClient = new WebClient();
            var pageSC = webClient.DownloadString("http://en.wikipedia.org/w/api.php?format=xml&action=query&prop=extracts&titles=" + textBox1.Text + "&redirects=true");
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(pageSC);

            var fnode = doc.GetElementsByTagName("extract")[0];
            try
            {
                string ss = fnode.InnerText;
                Regex regex = new Regex("\\<[^\\>]*\\>");
                string.Format("Before:{0}", ss);

                ss = regex.Replace(ss, string.Empty);
                string result = String.Format(ss);
                richTextBox2.Text = result;
            }
            catch
            {
                richTextBox2.Text = "error";
            }

Any and all help will be greatly appreciated.
If this is too vauge of a question please tell me and I will try to explain in more detail.
Thanks,
Wish

AnswerRe: Getting first paragraph of wikipedia using Voice C# Pin
Pete O'Hanlon26-Jul-18 22:45
mvePete O'Hanlon26-Jul-18 22:45 
GeneralRe: Getting first paragraph of wikipedia using Voice C# Pin
Wishingchain26-Jul-18 23:57
Wishingchain26-Jul-18 23:57 
AnswerRe: Getting first paragraph of wikipedia using Voice C# Pin
Eddy Vluggen27-Jul-18 0:06
professionalEddy Vluggen27-Jul-18 0:06 
GeneralRe: Getting first paragraph of wikipedia using Voice C# Pin
Wishingchain27-Jul-18 18:04
Wishingchain27-Jul-18 18:04 
GeneralRe: Getting first paragraph of wikipedia using Voice C# Pin
Eddy Vluggen27-Jul-18 23:47
professionalEddy Vluggen27-Jul-18 23:47 
GeneralRe: Getting first paragraph of wikipedia using Voice C# Pin
Wishingchain28-Jul-18 1:03
Wishingchain28-Jul-18 1:03 
GeneralRe: Getting first paragraph of wikipedia using Voice C# Pin
Eddy Vluggen28-Jul-18 1:27
professionalEddy Vluggen28-Jul-18 1:27 
AnswerRe: Getting first paragraph of wikipedia using Voice C# Pin
CP_Member88829-Jul-18 19:25
CP_Member88829-Jul-18 19:25 
QuestionPlotting a line graph in c# and retaining the previous graphs. Pin
Dipk1123-Jul-18 0:51
Dipk1123-Jul-18 0:51 
AnswerRe: Plotting a line graph in c# and retaining the previous graphs. Pin
OriginalGriff23-Jul-18 2:04
mveOriginalGriff23-Jul-18 2:04 
GeneralRe: Plotting a line graph in c# and retaining the previous graphs. Pin
Dipk1123-Jul-18 20:52
Dipk1123-Jul-18 20:52 
GeneralRe: Plotting a line graph in c# and retaining the previous graphs. Pin
Gerry Schmitz24-Jul-18 10:27
mveGerry Schmitz24-Jul-18 10:27 
Questioncreate separate XML file based on html tags in a string in C# Pin
sudipta saha20-Jul-18 19:40
sudipta saha20-Jul-18 19:40 
AnswerRe: create separate XML file based on html tags in a string in C# Pin
Eddy Vluggen20-Jul-18 23:46
professionalEddy Vluggen20-Jul-18 23:46 
AnswerRe: create separate XML file based on html tags in a string in C# Pin
Gerry Schmitz22-Jul-18 8:59
mveGerry Schmitz22-Jul-18 8:59 
GeneralC# Program Control Flow Pin
etl201620-Jul-18 11:20
etl201620-Jul-18 11:20 
GeneralRe: C# Program Control Flow Pin
OriginalGriff20-Jul-18 20:04
mveOriginalGriff20-Jul-18 20:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.