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

How to change the title of a Web Form through code?

P: n/a
Hi newsgroup,

could someone please tell how to change the title of a
Web Form window through VB.NET code?

In VB 6 I would write Me.Caption="title",
and what is it in VB.NET??

Thanks for your help

Regards,
Frank
Jul 21 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
KS
Look through the properties - find Text and see the value "Form1" - guess
what to do !

Me.Text="Title" - I would try that !

KS, Denmark

"Frank Lehmann" <f.******@world4net.com> skrev i en meddelelse
news:eI**************@TK2MSFTNGP12.phx.gbl...
Hi newsgroup,

could someone please tell how to change the title of a
Web Form window through VB.NET code?

In VB 6 I would write Me.Caption="title",
and what is it in VB.NET??

Thanks for your help

Regards,
Frank

Jul 21 '05 #2

P: n/a
Hi Keld,

I'm afraid Me.Text=.. is impossible. Text is not a property of Me
in this context.

Regards,
Frank
"KS" <ke************@os.dk> schrieb im Newsbeitrag news:e$**************@TK2MSFTNGP10.phx.gbl...
Look through the properties - find Text and see the value "Form1" - guess
what to do !

Me.Text="Title" - I would try that !

KS, Denmark

Jul 21 '05 #3

P: n/a
Try this :-

In the HEAD section of the ASP.NET page (.aspx) define the title as a server
side control:

<TITLE ID=PageTitle RUNAT=server></TITLE>

.... and in the code-behind (.aspx.vb) or inline code, define ...

Protected PageTitle As New HtmlGenericControl

.... and set the title from anywhere in the code as ...

Me.PageTitle.InnerText = "Hello World"

HTH,

--
- Paul Glavich
"Frank Lehmann" <f.******@world4net.com> wrote in message
news:#q**************@TK2MSFTNGP09.phx.gbl...
Hi Keld,

I'm afraid Me.Text=.. is impossible. Text is not a property of Me
in this context.

Regards,
Frank
"KS" <ke************@os.dk> schrieb im Newsbeitrag

news:e$**************@TK2MSFTNGP10.phx.gbl...
Look through the properties - find Text and see the value "Form1" - guess what to do !

Me.Text="Title" - I would try that !

KS, Denmark


Jul 21 '05 #4

P: n/a
Hi Keld,

Meanwhile I've found a smart solution myself:

http://www.developer.com/net/asp/article.php/2107811

Regards,
Frank
Jul 21 '05 #5

P: n/a
KS
Ooooooh - "WEB Form" - I did't see that - sorry !

KS, Denmark

"Frank Lehmann" <f.******@world4net.com> skrev i en meddelelse
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Keld,

I'm afraid Me.Text=.. is impossible. Text is not a property of Me
in this context.

Regards,
Frank
"KS" <ke************@os.dk> schrieb im Newsbeitrag

news:e$**************@TK2MSFTNGP10.phx.gbl...
Look through the properties - find Text and see the value "Form1" - guess what to do !

Me.Text="Title" - I would try that !

KS, Denmark


Jul 21 '05 #6

P: n/a
Frank Lehmann <f.******@world4net.com> wrote:
I'm afraid Me.Text=.. is impossible. Text is not a property of Me
in this context.


In that case you'll have to tell us what the context is, as a form
definitely has a Text property, inherited from Control.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #7

P: n/a
Hi Jon,

A Web Form doesn't have a Text property as I could read at

http://www.developer.com/net/asp/article.php/2107811

They simply forgot it.

The given site was also the solution to my problem.

Regards,
Frank
"Jon Skeet [C# MVP]" <sk***@pobox.com> schrieb im Newsbeitrag
news:MP************************@msnews.microsoft.c om...
Frank Lehmann <f.******@world4net.com> wrote:
I'm afraid Me.Text=.. is impossible. Text is not a property of Me
in this context.


In that case you'll have to tell us what the context is, as a form
definitely has a Text property, inherited from Control.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #8

P: n/a
Hi newsgroup,

Thank you all for your help.

I've found a solution at

http://www.developer.com/net/asp/article.php/2107811

Regards,
Frank
Jul 21 '05 #9

P: n/a
Frank Lehmann <f.******@world4net.com> wrote:
A Web Form doesn't have a Text property as I could read at

http://www.developer.com/net/asp/article.php/2107811

They simply forgot it.


Ah, my mistake - a *web* form rather than a *windows* form. Sorry about
that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #10

P: n/a
Make the <title> as a server side tag (<title runat="server">). add a HTML Generic Control in code behind with same identity of Title.

Now set the value at code behind. thats it.

HTH
Sudhakar Sadasivuni
Microsoft MVP | MCAD
www.mugh.net
www.mvpblog.com

Jul 21 '05 #11

P: n/a
I tried posting this earlier, dont know why it didn't get to the list, but
try this :-

In the HEAD section of the ASP.NET page (.aspx) define the title as a server
side control:

<TITLE ID=PageTitle RUNAT=server></TITLE>

.... and in the code-behind (.aspx.vb) or inline code, define ...

Protected PageTitle As New HtmlGenericControl

.... and set the title from anywhere in the code as ...

Me.PageTitle.InnerText = "Hello World"
--
- Paul Glavich
"Frank Lehmann" <f.******@world4net.com> wrote in message
news:#q**************@TK2MSFTNGP09.phx.gbl...
Hi Keld,

I'm afraid Me.Text=.. is impossible. Text is not a property of Me
in this context.

Regards,
Frank
"KS" <ke************@os.dk> schrieb im Newsbeitrag

news:e$**************@TK2MSFTNGP10.phx.gbl...
Look through the properties - find Text and see the value "Form1" - guess what to do !

Me.Text="Title" - I would try that !

KS, Denmark


Jul 21 '05 #12

P: n/a
read this

http://authors.aspalliance.com/chris...sp?article=141

--
Regards

John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------

"Frank Lehmann" <f.******@world4net.com> wrote in message
news:eI**************@TK2MSFTNGP12.phx.gbl...
Hi newsgroup,

could someone please tell how to change the title of a
Web Form window through VB.NET code?

In VB 6 I would write Me.Caption="title",
and what is it in VB.NET??

Thanks for your help

Regards,
Frank

Jul 21 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.