Click here to Skip to main content
16,004,453 members
Home / Discussions / C#
   

C#

 
QuestionC# Method for the VB.NET: Val(String)? Pin
JF201513-Feb-07 19:06
JF201513-Feb-07 19:06 
AnswerRe: C# Method for the VB.NET: Val(String)? Pin
stancrm13-Feb-07 19:51
stancrm13-Feb-07 19:51 
Questionhow to read Fast Large Xml File Pin
Sanjib Raj13-Feb-07 18:47
Sanjib Raj13-Feb-07 18:47 
AnswerRe: how to read Fast Large Xml File Pin
stancrm13-Feb-07 19:49
stancrm13-Feb-07 19:49 
GeneralRe: how to read Fast Large Xml File Pin
DavidNohejl14-Feb-07 0:28
DavidNohejl14-Feb-07 0:28 
AnswerRe: how to read Fast Large Xml File Pin
DavidNohejl14-Feb-07 0:32
DavidNohejl14-Feb-07 0:32 
QuestionUser Control Question.... Pin
Khoramdin13-Feb-07 18:40
Khoramdin13-Feb-07 18:40 
Questiondisplaying results in another form Pin
frossie13-Feb-07 18:27
frossie13-Feb-07 18:27 
Hi i have a form1 that allows user to search for words.
Then i have another form2 that is for displaying the results, taking into consideration the parameters from form1.

However i have errors telling me that the richTextBox1 that i'm using it in form2 is inaccessible due to its protection level.

Error 1 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 126 32 LookUpShakespeare
Error 2 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 127 32 LookUpShakespeare
Error 3 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 135 40 LookUpShakespeare
Error 4 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 136 40 LookUpShakespeare
Error 5 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 137 40 LookUpShakespeare
Error 6 'LookUpShakespeare.Form4.richTextBox1' is inaccessible due to its protection level G:\WebServices\Project\Projects\LookUpShakespeare\LookUpShakespeare\Form2.cs 138 40 LookUpShakespeare



Can anyone help me to solve this?

FORM1
using LookUpShakespeare.GoogleSvc;<br />
<br />
namespace LookUpShakespeare<br />
{<br />
    public partial class Form2 : Form<br />
    {<br />
        public Form2()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
        public TextBox t1 = new TextBox();<br />
        public TextBox t2 = new TextBox();<br />
<br />
        private void btnGenerate_Click(object sender, EventArgs e)<br />
        {<br />
            String buildTerm = "";<br />
            if (radioButton5.Checked == true)<br />
                buildTerm = word.Text;<br />
            else<br />
                buildTerm = "\"" + word.Text + "\"";<br />
<br />
            if (radioButton2.Checked == true)<br />
                buildTerm = "-" + buildTerm;<br />
            <br />
            if (txtSearchString.Text != "")<br />
                if (radioButton4.Checked == true)<br />
                    buildTerm = " OR " + buildTerm;<br />
                else<br />
                    buildTerm = " " + buildTerm;<br />
<br />
            if (checkBox3.Checked == true)<br />
            {<br />
                <br />
                t1.Text = "true";<br />
            }<br />
            else<br />
            {<br />
                t1.Text = "false";<br />
            }<br />
<br />
            if (checkBox4.Checked == true)<br />
            {<br />
<br />
                t2.Text = "true";<br />
            }<br />
            else<br />
            {<br />
                t2.Text = "false";<br />
            }<br />
<br />
            if (comboBox1.Text != "")<br />
            {<br />
                comboBox1.Text = comboBox1.SelectedItem.ToString();<br />
            }<br />
            else<br />
            {<br />
                comboBox1.Text = "English";<br />
            }<br />
<br />
            if (word.Text != "")<br />
            {<br />
                txtSearchString.Text += buildTerm;<br />
                buildTerm = "";<br />
                word.Text = "";<br />
                groupBox3.Enabled = true;<br />
            }            <br />
        }<br />
<br />
        public int beginResultPage = 0;<br />
        public string q, combo;<br />
        public Boolean f, s;<br />
       <br />
        private void btnSearch_Click(object sender, EventArgs e)<br />
        {<br />
            GoogleSearchService gsearch = new GoogleSearchService(); <br />
            GoogleSearchResult gresult = new GoogleSearchResult();<br />
            try<br />
            {<br />
                q = this.txtSearchString.Text;<br />
                f = Convert.ToBoolean(this.t1.Text);<br />
                s = Convert.ToBoolean(this.t2.Text);<br />
                combo = this.comboBox1.Text;<br />
                showResults(this.beginResultPage, this.key.Text, q, f, s, combo);<br />
<br />
            }<br />
            catch (System.Web.Services.Protocols.SoapException ex)<br />
            {<br />
                MessageBox.Show(ex.Message);<br />
            }<br />
        }<br />
        private void showResults(int beginResultPage, string key, string q, Boolean f, Boolean s, string combo)<br />
        {<br />
            GoogleSearchService gsearch = new GoogleSearchService();<br />
            GoogleSearchResult gresult = new GoogleSearchResult();<br />
            try<br />
            {<br />
                gresult = gsearch.doGoogleSearch(key, q, beginResultPage, 10, f, "", s, combo, "", "");<br />
                Form4 ResultForm = new Form4();<br />
                ResultForm.SearchForm = this;<br />
                ResultForm.Text = "Estimated Result Count: " + gresult.estimatedTotalResultsCount.ToString();<br />
                int j = gresult.resultElements.Length;<br />
                ResultForm.elementCount = j;<br />
                if (j == 0)<br />
                <pre>{<br />
                    ResultForm.<big>richTextBox1</big>.Text += "Google Search results: " + "\r";<br />
                    ResultForm.<big>richTextBox1</big>.Text += "Sorry, no search results to display!";<br />
                }</pre>                else<br />
                {<br />
                    for (int i = 0; i < j; i++)<br />
                    {<br />
                        if (gresult.resultElements[i] != null)<br />
                        <pre>{<br />
                            ResultForm.<big>richTextBox1</big>.Text += "Return Result # " + (beginResultPage + i + 1).ToString() + "\r";<br />
                            ResultForm.<big>richTextBox1</big>.Text += gresult.resultElements[i].title + "\r";<br />
                            ResultForm.<big>richTextBox1</big>.Text += gresult.resultElements[i].snippet + "\r";<br />
                            ResultForm.<big>richTextBox1</big>.Text += gresult.resultElements[i].URL + "\r\r";<br />
                        }</pre>                    }<br />
                }<br />
                ResultForm.Show();<br />
            }<br />
            catch (System.Web.Services.Protocols.SoapException ex)<br />
            {<br />
                MessageBox.Show(ex.Message);<br />
            }<br />
        }<br />
<br />
    }<br />
}


FORM2
using LookUpShakespeare.GoogleSvc;<br />
<br />
namespace LookUpShakespeare<br />
{<br />
    public partial class Form4 : Form<br />
    {<br />
        public Form4()<br />
        {<br />
            InitializeComponent();<br />
        }<br />
        public Form2 SearchForm;<br />
        public int elementCount = 0;<br />
<br />
        <br />
<br />
    }<br />
}



Regards, frossie

AnswerRe: displaying results in another form Pin
miestas13-Feb-07 20:17
miestas13-Feb-07 20:17 
QuestionProblem with RichTextBox SelectedRtf Pin
Abisodun13-Feb-07 18:13
Abisodun13-Feb-07 18:13 
AnswerRe: Problem with RichTextBox SelectedRtf Pin
Apemania29-May-12 15:56
Apemania29-May-12 15:56 
GeneralRe: Problem with RichTextBox SelectedRtf Pin
Abisodun20-Jun-12 15:52
Abisodun20-Jun-12 15:52 
GeneralRe: Problem with RichTextBox SelectedRtf Pin
Apemania20-Jun-12 17:45
Apemania20-Jun-12 17:45 
QuestionSocket Programming. Pin
Rahul.RK13-Feb-07 18:09
Rahul.RK13-Feb-07 18:09 
Questionsql server triggers+ c# Pin
kalyan_241613-Feb-07 17:25
kalyan_241613-Feb-07 17:25 
AnswerRe: sql server triggers+ c# Pin
Pete O'Hanlon13-Feb-07 22:44
mvePete O'Hanlon13-Feb-07 22:44 
QuestionReduce the Color depth of a Bit Map Image. Pin
Ranga_KN13-Feb-07 17:04
Ranga_KN13-Feb-07 17:04 
QuestionChatty Web Method Pin
convivial.developer13-Feb-07 16:02
convivial.developer13-Feb-07 16:02 
QuestionCombobBox SelectedIndexChanged Event Pin
KrunalC13-Feb-07 15:10
KrunalC13-Feb-07 15:10 
AnswerRe: CombobBox SelectedIndexChanged Event Pin
Christian Graus13-Feb-07 15:25
protectorChristian Graus13-Feb-07 15:25 
GeneralRe: CombobBox SelectedIndexChanged Event Pin
KrunalC13-Feb-07 17:54
KrunalC13-Feb-07 17:54 
GeneralRe: CombobBox SelectedIndexChanged Event Pin
Christian Graus13-Feb-07 18:11
protectorChristian Graus13-Feb-07 18:11 
AnswerRe: CombobBox SelectedIndexChanged Event Pin
miestas13-Feb-07 19:47
miestas13-Feb-07 19:47 
AnswerRe: CombobBox SelectedIndexChanged Event Pin
Rhys Gravell13-Feb-07 23:21
professionalRhys Gravell13-Feb-07 23:21 
QuestionCalling files Pin
sreecahitu13-Feb-07 15:09
sreecahitu13-Feb-07 15:09 

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.