-
May 28th, 2008, 09:10 PM
#1
Thread Starter
Member
How to write a welcome note in the main page?
Hello, My question is, after logging in, i've reached the main page. Then i would like a messageBox to pop out saying that "You have entered *this* page". It has to pop out as soon as I enter the page. Please help as time is not on my side. Thanks a lot.
-
May 28th, 2008, 09:16 PM
#2
Re: How to write a welcome note in the main page?
What is this? A webapp in asp.net or a desktop app with Winforms?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
May 28th, 2008, 09:18 PM
#3
Thread Starter
Member
Re: How to write a welcome note in the main page?
A webapp in asp.net using vb.net.
-
May 28th, 2008, 09:20 PM
#4
Re: How to write a welcome note in the main page?
Ok, I can move this thread to the proper forum then.
Codebank is for finished tips and tricks etc.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
-
May 29th, 2008, 02:10 AM
#5
Re: How to write a welcome note in the main page?
Add some javascript to the page.
<script type="text/JavaScript">
alert('Hello, welcome to this page.');
</script>
You can also use ClientScript.RegisterStartupScript() to output javascript to the page.
-
May 29th, 2008, 02:23 AM
#6
Thread Starter
Member
Re: How to write a welcome note in the main page?
Can we use these scripts in the webapplication? where do I insert this codes? I'm quite lost here. Can't we write it in vb.net format?
Thanks.
-
May 29th, 2008, 06:20 AM
#7
Re: How to write a welcome note in the main page?
Can't we write it in vb.net format?
Nope, what you have to think of is that, within an Internet/Intranet application, the webserver simply serves up and posts web pages it has, when users request the pages. Those pages are then disconnected and have no more to do with the server at all - they're simply rendered within the user's browser.
So writing server side code to bring up an operating system messagebox isn't available, all you have is the ability of throwing up a browser alert box via the use of a client side scripting language, such as Javascript.
Where do I insert this codes? I'm quite lost here.
Well assuming you want to show this alert when the page is first displayed to the user, then you can place the above code within the HTML, like so:
Code:
<html>
<head>
<script language="javascript">
function ShowMeTheMessage() {
alert('Hello world!');
}
</script>
</head>
<body onLoad="javascript: ShowMeTheMessage();">
</body>
</html>
-
May 29th, 2008, 07:13 AM
#8
Thread Starter
Member
Re: How to write a welcome note in the main page?
Ok. But how do I convert these codes into the vb.net format? Like which part do I write these codes? the showmethemessage box, will i have to change it to MsgBox("Hello world")? Is it like that? Please explain and show me. Thanks.
-
May 29th, 2008, 07:20 AM
#9
Re: How to write a welcome note in the main page?
Again you can't really use VB.Net here, you need to use a client scripting language such as VBScript or JavaScript. As JavaScript is supported on more browsers, I've opted to write the sample in that above. You'd be able to see looking at that where I've written the wording "hello world" in it's this part (it doesn't really matter if you use single or double quotes to surround the string in Javascript):
Code:
alert('Hello world!');
Basically these 2 are the same thing, top in Javascript, 2nd in VBNet
Code:
function ShowMeTheMessage() {
}
Private Function ShowMeTheMessage
End Function
and these 2 are the same:
Code:
alert('Hello world!');
Messagebox.Show("Hello world!")
Last edited by alex_read; May 29th, 2008 at 07:23 AM.
-
May 29th, 2008, 07:37 AM
#10
Thread Starter
Member
Re: How to write a welcome note in the main page?
Oh ok. Thanks a lot. I'll try that. Thanks again. Been a great help. :P
-
May 29th, 2008, 02:47 PM
#11
Re: How to write a welcome note in the main page?
vb Code:
Public Sub ShowTheMessage(theMessage As String) ClientScript.RegisterStartupScript(Me.GetType(), "MyAlert", "<script type='text/javascript'>alert('" & theMessage & "');</script>") End Sub
That's how you'd do it from your codebehind to dynamically generate an alert box with your message in it. You can call it from any event such as Page Load, a Button Click and so on.
ShowTheMessage("Hello World")
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|