By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,173 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,173 IT Pros & Developers. It's quick & easy.

View > Source

P: n/a
hey everybody,

I have written a great browser but it is missing a feature (quite a lot
actually, but forget about them for now). that feature just so happens to be
the View > Source function. for those of you who don't what i mean, it is
when you click a button in the view menu that says Page source (in Netscape)
and source (in Internet Explorer). if you click it, notepad opens. in that
window is the html for the page.

anyway, does anyone know how to show the source?

--
Alvo von Cossel I of Germany
Nov 17 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
The easiest way for you to do it would be to make sure you’ve got a copy of
the source saved to some temporary location and launch a copy of notepad via
the Process class with either the /A or /W argument followed by the filename
of this temp file.

If you wanted to stay completely within your code, a new form with a large,
multi-line textbox too would do the job, however for my money I would
probably go with notepad just because of it’s simplicity.

Just for note, with regards to the above arguments, /A opens the file as an
ANSI file while /w opens it as Unicode.

Brendan
"Alvo von Cossel I" wrote:
hey everybody,

I have written a great browser but it is missing a feature (quite a lot
actually, but forget about them for now). that feature just so happens to be
the View > Source function. for those of you who don't what i mean, it is
when you click a button in the view menu that says Page source (in Netscape)
and source (in Internet Explorer). if you click it, notepad opens. in that
window is the html for the page.

anyway, does anyone know how to show the source?

--
Alvo von Cossel I of Germany

Nov 17 '05 #2

P: n/a
hi,

thanks brendan. i want to do it with the new form because it would seem more
simple and it would take up less storage space on your HDD. would you know
how to do that?

--
Alvo von Cossel I of Germany
"Brendan Grant" wrote:
The easiest way for you to do it would be to make sure you’ve got a copy of
the source saved to some temporary location and launch a copy of notepad via
the Process class with either the /A or /W argument followed by the filename
of this temp file.

If you wanted to stay completely within your code, a new form with a large,
multi-line textbox too would do the job, however for my money I would
probably go with notepad just because of it’s simplicity.

Just for note, with regards to the above arguments, /A opens the file as an
ANSI file while /w opens it as Unicode.

Brendan
"Alvo von Cossel I" wrote:
hey everybody,

I have written a great browser but it is missing a feature (quite a lot
actually, but forget about them for now). that feature just so happens to be
the View > Source function. for those of you who don't what i mean, it is
when you click a button in the view menu that says Page source (in Netscape)
and source (in Internet Explorer). if you click it, notepad opens. in that
window is the html for the page.

anyway, does anyone know how to show the source?

--
Alvo von Cossel I of Germany

Nov 17 '05 #3

P: n/a
To do it all within your C# app I would do it as follows:

1. Create a new Windows Form.
2. Add a textbox to the form and name it sourceTextBox
3. Set Multiline to True and Dock to fill on sourceTextBox
4. Add the following property to the code of the Form:
public string Source
{
set
{
sourceTextBox.Text = value;
}
}

5. When in your code you wish to view the source, simply create a new
instance of your newly created source viewing form, set the Source property
on it equal to the string containing the source, and call the Show() or
ShowDialog() method on it to display it.

Simple enough?

Brendan
"Alvo von Cossel I" wrote:
hi,

thanks brendan. i want to do it with the new form because it would seem more
simple and it would take up less storage space on your HDD. would you know
how to do that?

--
Alvo von Cossel I of Germany
"Brendan Grant" wrote:
The easiest way for you to do it would be to make sure you’ve got a copy of
the source saved to some temporary location and launch a copy of notepad via
the Process class with either the /A or /W argument followed by the filename
of this temp file.

If you wanted to stay completely within your code, a new form with a large,
multi-line textbox too would do the job, however for my money I would
probably go with notepad just because of it’s simplicity.

Just for note, with regards to the above arguments, /A opens the file as an
ANSI file while /w opens it as Unicode.

Brendan
"Alvo von Cossel I" wrote:
hey everybody,

I have written a great browser but it is missing a feature (quite a lot
actually, but forget about them for now). that feature just so happens to be
the View > Source function. for those of you who don't what i mean, it is
when you click a button in the view menu that says Page source (in Netscape)
and source (in Internet Explorer). if you click it, notepad opens. in that
window is the html for the page.

anyway, does anyone know how to show the source?

--
Alvo von Cossel I of Germany

Nov 17 '05 #4

P: n/a
hi,

i get a message saying: 'Source': member names cannot be the same as their
enclosing type

what does it mean?

by the way, here is the line with the error:

public string Source() // <<Error here
{
set;
{
sourceTextBox.Text = value;
}
}
--
Alvo von Cossel I of Germany
"Brendan Grant" wrote:
To do it all within your C# app I would do it as follows:

1. Create a new Windows Form.
2. Add a textbox to the form and name it sourceTextBox
3. Set Multiline to True and Dock to fill on sourceTextBox
4. Add the following property to the code of the Form:
public string Source
{
set
{
sourceTextBox.Text = value;
}
}

5. When in your code you wish to view the source, simply create a new
instance of your newly created source viewing form, set the Source property
on it equal to the string containing the source, and call the Show() or
ShowDialog() method on it to display it.

Simple enough?

Brendan
"Alvo von Cossel I" wrote:
hi,

thanks brendan. i want to do it with the new form because it would seem more
simple and it would take up less storage space on your HDD. would you know
how to do that?

--
Alvo von Cossel I of Germany
"Brendan Grant" wrote:
The easiest way for you to do it would be to make sure you’ve got a copy of
the source saved to some temporary location and launch a copy of notepad via
the Process class with either the /A or /W argument followed by the filename
of this temp file.

If you wanted to stay completely within your code, a new form with a large,
multi-line textbox too would do the job, however for my money I would
probably go with notepad just because of it’s simplicity.

Just for note, with regards to the above arguments, /A opens the file as an
ANSI file while /w opens it as Unicode.

Brendan
"Alvo von Cossel I" wrote:

> hey everybody,
>
> I have written a great browser but it is missing a feature (quite a lot
> actually, but forget about them for now). that feature just so happens to be
> the View > Source function. for those of you who don't what i mean, it is
> when you click a button in the view menu that says Page source (in Netscape)
> and source (in Internet Explorer). if you click it, notepad opens. in that
> window is the html for the page.
>
> anyway, does anyone know how to show the source?
>
> --
> Alvo von Cossel I of Germany

Nov 17 '05 #5

P: n/a
remove the parenthesis... should just be "public string Source" as it's
a property, not a method.

"Alvo von Cossel I" <Al************@discussions.microsoft.com> wrote in
message news:C7**********************************@microsof t.com...
hi,

i get a message saying: 'Source': member names cannot be the same as their
enclosing type

what does it mean?

by the way, here is the line with the error:

public string Source() // <<Error here
{
set;
{
sourceTextBox.Text = value;
}
}
--
Alvo von Cossel I of Germany
"Brendan Grant" wrote:
To do it all within your C# app I would do it as follows:

1. Create a new Windows Form.
2. Add a textbox to the form and name it sourceTextBox
3. Set Multiline to True and Dock to fill on sourceTextBox
4. Add the following property to the code of the Form:
public string Source
{
set
{
sourceTextBox.Text = value;
}
}

5. When in your code you wish to view the source, simply create a new
instance of your newly created source viewing form, set the Source
property
on it equal to the string containing the source, and call the Show() or
ShowDialog() method on it to display it.

Simple enough?

Brendan
"Alvo von Cossel I" wrote:
> hi,
>
> thanks brendan. i want to do it with the new form because it would seem
> more
> simple and it would take up less storage space on your HDD. would you
> know
> how to do that?
>
> --
> Alvo von Cossel I of Germany
>
>
> "Brendan Grant" wrote:
>
> > The easiest way for you to do it would be to make sure you've got a
> > copy of
> > the source saved to some temporary location and launch a copy of
> > notepad via
> > the Process class with either the /A or /W argument followed by the
> > filename
> > of this temp file.
> >
> > If you wanted to stay completely within your code, a new form with a
> > large,
> > multi-line textbox too would do the job, however for my money I would
> > probably go with notepad just because of it's simplicity.
> >
> > Just for note, with regards to the above arguments, /A opens the file
> > as an
> > ANSI file while /w opens it as Unicode.
> >
> > Brendan
> >
> >
> > "Alvo von Cossel I" wrote:
> >
> > > hey everybody,
> > >
> > > I have written a great browser but it is missing a feature (quite a
> > > lot
> > > actually, but forget about them for now). that feature just so
> > > happens to be
> > > the View > Source function. for those of you who don't what i mean,
> > > it is
> > > when you click a button in the view menu that says Page source (in
> > > Netscape)
> > > and source (in Internet Explorer). if you click it, notepad opens.
> > > in that
> > > window is the html for the page.
> > >
> > > anyway, does anyone know how to show the source?
> > >
> > > --
> > > Alvo von Cossel I of Germany

Nov 17 '05 #6

P: n/a
hi,

thanks but now i get an error on one of the curly brackets instead of the
Source:

public string Source
{
set;
{ // <<error here. It says: a get or set accessor expected
sourceTextBox.Text = value;
}
}

cheers,

--
Alvo von Cossel I of Germany
"Dan Bass" wrote:
remove the parenthesis... should just be "public string Source" as it's
a property, not a method.

"Alvo von Cossel I" <Al************@discussions.microsoft.com> wrote in
message news:C7**********************************@microsof t.com...
hi,

i get a message saying: 'Source': member names cannot be the same as their
enclosing type

what does it mean?

by the way, here is the line with the error:

public string Source() // <<Error here
{
set;
{
sourceTextBox.Text = value;
}
}
--
Alvo von Cossel I of Germany
"Brendan Grant" wrote:
To do it all within your C# app I would do it as follows:

1. Create a new Windows Form.
2. Add a textbox to the form and name it sourceTextBox
3. Set Multiline to True and Dock to fill on sourceTextBox
4. Add the following property to the code of the Form:
public string Source
{
set
{
sourceTextBox.Text = value;
}
}

5. When in your code you wish to view the source, simply create a new
instance of your newly created source viewing form, set the Source
property
on it equal to the string containing the source, and call the Show() or
ShowDialog() method on it to display it.

Simple enough?

Brendan
"Alvo von Cossel I" wrote:

> hi,
>
> thanks brendan. i want to do it with the new form because it would seem
> more
> simple and it would take up less storage space on your HDD. would you
> know
> how to do that?
>
> --
> Alvo von Cossel I of Germany
>
>
> "Brendan Grant" wrote:
>
> > The easiest way for you to do it would be to make sure you've got a
> > copy of
> > the source saved to some temporary location and launch a copy of
> > notepad via
> > the Process class with either the /A or /W argument followed by the
> > filename
> > of this temp file.
> >
> > If you wanted to stay completely within your code, a new form with a
> > large,
> > multi-line textbox too would do the job, however for my money I would
> > probably go with notepad just because of it's simplicity.
> >
> > Just for note, with regards to the above arguments, /A opens the file
> > as an
> > ANSI file while /w opens it as Unicode.
> >
> > Brendan
> >
> >
> > "Alvo von Cossel I" wrote:
> >
> > > hey everybody,
> > >
> > > I have written a great browser but it is missing a feature (quite a
> > > lot
> > > actually, but forget about them for now). that feature just so
> > > happens to be
> > > the View > Source function. for those of you who don't what i mean,
> > > it is
> > > when you click a button in the view menu that says Page source (in
> > > Netscape)
> > > and source (in Internet Explorer). if you click it, notepad opens.
> > > in that
> > > window is the html for the page.
> > >
> > > anyway, does anyone know how to show the source?
> > >
> > > --
> > > Alvo von Cossel I of Germany


Nov 17 '05 #7

P: n/a
In message <BF**********************************@microsoft.co m>, Alvo
von Cossel I <Al************@discussions.microsoft.com> writes
hey everybody,

I have written a great browser but it is missing a feature (quite a lot
actually, but forget about them for now). that feature just so happens to be
the View > Source function. for those of you who don't what i mean, it is
when you click a button in the view menu that says Page source (in Netscape)
and source (in Internet Explorer). if you click it, notepad opens. in that
window is the html for the page.


What do you mean when you say you've "written" a browser; do you mean
that you've written one from the ground up (in which case only you know
how to get to the raw html) or that you've embedded the IE browser in
your application?

If it's the latter, then something like:

mshtml.HTMLDocumentClass doc =
(mshtml.HTMLDocumentClass)this.axWebBrowser1.Docum ent;
MessageBox.Show(doc.documentElement.innerHTML);

should do what you want.
--
Steve Walker
Nov 17 '05 #8

P: n/a
"Alvo von Cossel I" <Al************@discussions.microsoft.com> wrote in
message news:75**********************************@microsof t.com...
hi,

thanks but now i get an error on one of the curly brackets instead of the
Source:

public string Source
{
set;
{ // <<error here. It says: a get or set accessor expected

<snip>

Lose the semicolon after the set
Nov 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.